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
| Field | Type | Required | Notes |
|---|---|---|---|
chainId | string | Required | Full CAIP-19 |
keyPath | string | Required | BIP-44 — must match /^m(\/\d+'?)+$/, otherwise param_error. |
label | string | Required | Account label — 2–14 chars, a-z A-Z 0-9 . ! # $ % & + - _ only. No spaces; anything else is param_error. |
token.contract | string | Optional | Present 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::assetName (e.g. SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-token::diko). Empty or malformed → param_error. |
token.symbol | string | Optional | Display 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.decimals | number | Optional | Integer 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.addressFormat | enum | Optional | Same enum as getAddress (legacy / segwit-wrapped / segwit-native / taproot). Disambiguates BTC-family variants that share the same chainId (bip122:.../slip44:0) so the bridge can register the right coin_name — e.g. sync a legacy and a segwit-native account for the same BTC keyPath as two separate entries. |
info
Use the on-chain identifier. Chains whose DCENT registry entry uses an internal 4-part form (Stellar, Stacks, XRP) are converted by the wallet — send AQUA-GBNZ…, not 0.GBNZ….AQUA.999….
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.
{
"header": { "version": "1.0", "status": "success" },
"body": { "command": "syncAccount" }
}
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.