Skip to main content

Built-in networks

Powfi.load({ networkId }) picks one of these configurations (defaultNetworks): An unknown networkId throws Network <id> not found.

Overriding endpoints

Use networkOverrides to replace any field except id:
Network fields:
NetworkId
required
'mainnet' | 'testnet' | 'devnet'. Selects both the endpoints and the bundled contract deployments.
string
Display name.
string
Full node REST endpoint.
string
Optional API key sent to the node.
string
Explorer backend endpoint (used by powfi.explorerProvider).
string
Explorer web UI, for building links.
string
JSON token list with shape { tokens: TokenInfo[] }.

Contract addresses

Each module loads its contract IDs from the deployment files bundled with the SDK (cpmm/deployments, clmm/deployments, staking/deployments) for the chosen networkId: To point a module at a different deployment (a fork, or your own devnet), override its config after loading:
Read the active config with powfi.cpmm.getConfig(), powfi.clmm.getClmmConfig(), and powfi.staking.getConfig().
The getter names differ between modules. On ClmmModule, getConfig() re-reads the bundled deployment file and ignores any setConfig override. Use getClmmConfig() to read the active config. On CpmmModule it’s the other way round: getConfig() returns the active config and getCpmmConfig() re-reads the deployment.

Groups and addresses

Alephium is sharded into address groups, and every Powfi contract for a module lives in one group (config.groupIndex). Pool, position, and vault IDs are derived as sub-contracts in that group, so they can be computed offline:
Groupless addresses (new-style addresses without a :group suffix) are normalized with normalizeAddress(address, group), which appends :<group> when needed. The SDK does this internally for sender, owner, recipient, and fee-recipient arguments.

Local devnet

The SDK’s integration tests run against a local Alephium devnet:
With networkId: 'devnet', the SDK uses 127.0.0.1:22973 and the devnet deployments. The devnet unstake duration is 1 minute instead of 30 days.