ledger_verify_address
Display an address on your Ledger device for physical verification to confirm its accuracy before use.
Instructions
Display address on Ledger device for physical verification
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/ledger.ts:24-49 (handler)Handler for ledger_verify_address tool. Checks signer, validates ledger key type, calls ledgerShowAddress with timeout, returns verification result.
registry.register({ name: 'ledger_verify_address', group: 'ledger', description: 'Display address on Ledger device for physical verification', schema: {}, annotations: { readOnlyHint: true }, handler: async (_params, { chainManager, config }) => { chainManager.requireSigner(); if (config.key.type !== 'ledger') { return success({ verified: false, reason: 'Not using Ledger key.' }); } const address = await Promise.race([ chainManager.ledgerShowAddress(), new Promise<never>((_, reject) => setTimeout( () => reject(new LedgerSignError('Address verification timed out.')), LEDGER_SIGN_TIMEOUT, ), ), ]); return success({ verified: true, address }); }, }); - src/tools/ledger.ts:28-28 (schema)No input schema required for ledger_verify_address (empty object).
schema: {}, - src/tools/ledger.ts:24-49 (registration)Registration of ledger_verify_address tool in the singleton ToolRegistry via registry.register().
registry.register({ name: 'ledger_verify_address', group: 'ledger', description: 'Display address on Ledger device for physical verification', schema: {}, annotations: { readOnlyHint: true }, handler: async (_params, { chainManager, config }) => { chainManager.requireSigner(); if (config.key.type !== 'ledger') { return success({ verified: false, reason: 'Not using Ledger key.' }); } const address = await Promise.race([ chainManager.ledgerShowAddress(), new Promise<never>((_, reject) => setTimeout( () => reject(new LedgerSignError('Address verification timed out.')), LEDGER_SIGN_TIMEOUT, ), ), ]); return success({ verified: true, address }); }, }); - src/initia/chain-manager.ts:120-129 (helper)ChainManager.ledgerShowAddress() - Helper that dynamically imports @initia/ledger-key, validates the key is a LedgerKey, calls showAddressAndPubKey() on the ledger device, and returns the address.
async ledgerShowAddress(): Promise<string> { if (!this.key) throw new SignerRequiredError(); const { LedgerKey } = await import('@initia/ledger-key'); if (!(this.key instanceof LedgerKey)) { throw new LedgerConnectionError('Key is not a LedgerKey instance.'); } const lk = this.key as any; await lk.showAddressAndPubKey(); return this.key.address; }