Skip to main content

syncAccount

Registers / synchronizes accounts on the device. Each item is validated (chainId charset + BIP-44 keyPath + label rule); chain resolution is delegated to the bridge.

Signature​

await dcent.syncAccount(accounts: V2SyncAccountInfo[]): Promise<V1Response>
// V2SyncAccountInfo = { chainId, keyPath, label, token?: { contract, symbol?, decimals? }, meta?: { addressFormat? } }

Parameters​

FieldTypeRequiredNotes
chainIdstringRequiredFull CAIP-19
keyPathstringRequiredBIP-44 — must match /^m(\/\d+'?)+$/, otherwise param_error.
labelstringRequiredAccount label — 2–14 chars, a-z A-Z 0-9 . ! # $ % & + - _ only. No spaces; anything else is param_error. A non-string value other than undefined is converted with String() before the check (null becomes the label "null").
token.contractstringOptionalPresent only for token accounts. Use the chain's on-chain identifier — not DCENT’s internal 4-part form. EVM 0xdac17f958d2ee523a2206206994597c13d831ec7 / SPL mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB / Hedera 0.0.333611 / NEAR token.sweat / Stellar CODE-ISSUER (e.g. AQUA-GBNZILSTVQZ4R7IKQDGHYGY2QXL5QOFJYQMXPKWRRM5PAV7Y4M67AQUA) / Stacks principal.contractName for a token DCENT already supports (e.g. SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-token); add ::assetName — together with decimals — only for a token DCENT does not support. Empty or malformed → param_error.
token.symbolstringOptionalDisplay symbol. The device matches its coin icon on this value (lower-cased, truncated to 8 chars by the wallet). Effectively required for tokens that are not in DCENT’s registry — without it the first 10 characters of the contract become the symbol and no icon matches.
token.decimalsnumberOptionalInteger in [0, 255]. Required for tokens that are not in DCENT’s registry — the bridge refuses to synthesize a token it cannot describe and returns -32602. Registered tokens ignore this field (registry values win).
meta.addressFormatenumOptionalSame enum as getAddress — pass back the value getAccountInfo returned. Disambiguates accounts that share one chainId and keyPath so the bridge can register the right coin_name — BTC-family encodings (e.g. sync a legacy and a segwit-native account for the same BTC keyPath as two separate entries), the Tezos Standard account (standard) and the Algorand Ledger account (ledger). Without it those accounts are registered as the default account.
info

Use the on-chain identifier. Chains whose DCENT registry entry uses an internal form (Stellar, Stacks, XRP, and Substrate parachain XC20 tokens) are matched by their on-chain identifier — CODE-ISSUER for Stellar (send AQUA-GBNZ…, not 0.GBNZ….AQUA.999…), principal.contractName for Stacks, the bare asset id for XC20, and for XRP <currency>.<issuer> with the currency exactly as DCENT's registry keys it (case-sensitive; a lowercase 40-hex code for some tokens).

await dcent.syncAccount([
// coin
{ chainId: 'eip155:1/slip44:60', keyPath: "m/44'/60'/0'/0/0", label: 'ETH-1' },
// registered token — contract alone is enough
{ chainId: 'eip155:1/slip44:60', keyPath: "m/44'/60'/0'/0/0", label: 'USDT-1',
token: { contract: '0xdac17f958d2ee523a2206206994597c13d831ec7' } },
// unregistered token — send symbol + decimals as well
{ chainId: 'eip155:1/slip44:60', keyPath: "m/44'/60'/0'/0/0", label: 'FOO-1',
token: { contract: '0x1111111111111111111111111111111111111111', symbol: 'FOO', decimals: 6 } },
])
await dcent.syncAccount([
{
chainId: 'eip155:1/slip44:60',
keyPath: "m/44'/60'/0'/0/0",
label: 'ETH_0'
},
])

Response​

Returns a V1Response acknowledging the sync. Read header.status — 'success' means every item was accepted by the device; a rejected item fails the call with an error code. body.parameter carries the device's raw sync_account acknowledgement; do not rely on its shape.

{
"header": { "version": "1.0", "status": "success", "response_from": "syncAccount" },
"body": { "command": "syncAccount", "parameter": { "response": { "…": "device acknowledgement" } } }
}
warning

Breaking from v1. The v1 item shape { coin_group, coin_name, label } is no longer accepted — use { chainId, keyPath, label }. A non-array argument throws param_error.