Whose wallet (`owner`)
Whose wallet (`owner`)
When you load balances, allowances, or positions (including stake and farm rows), Nutrimatic needs to know which wallet address to look up. That address is the optional owner field on those reads.
What you should do
| Your situation | What to do |
|---|---|
The user is connected and you passed a wallet in config | Omit owner. Nutrimatic calls wallet.getAddress() and uses that address. |
| You already know the address (or you query many addresses) | Pass owner: '0x…' (or the ledger’s address format) on each call. |
You have no wallet in config | Always pass owner. If you omit it, the SDK throws WALLET_REQUIRED. |
This is independent of mode: a wallet in config can supply the default address even when you only read.
Example — connected wallet (omit owner)
const sdk = createNutrimaticSdk({
ledgers: [{ id: 'evm:421018', kind: 'evm', chainId: 421018, alias: 'infinite-mainnet' }],
mode: 'read',
integrationContext: 'client',
wallet: myWalletAdapter,
})
// Uses await myWalletAdapter.getAddress()
const balance = await sdk.balances.getBalance({
instrumentId: 'evm:421018:instrument:42',
})Example — pass the address
const balance = await sdk.balances.getBalance({
instrumentId: 'evm:421018:instrument:42',
owner: '0xabc…',
})Use this for backends, indexers, admin tools, or any screen that is not “the connected user”.
Methods that use owner
| Module | Reads that take owner |
|---|---|
| Balances | getBalance, getAllowance |
| Positions | listPositions, getPosition |
| Staking | stake position reads |
| Farming | farm position reads |
Related
| Goal | Start here |
|---|---|
Put wallet in config | Configuration — wallet · Wallet adapter |
| Balances / allowances | Balances |
| Portfolio table | Positions |
WALLET_REQUIRED | Errors |