Minka Ledger Docs
How To Guides

How to query wallet anchors

DateResponsibleChanges
November 16, 2023@Luis FidelisInitial version

Ledger SDK allows users to create anchors connected wallets and query them.

Creating anchors

import { LedgerSdk } from '@minka/ledger-sdk'
 
const sdk = new LedgerSdk({
    server: '<your ledger URL>',
    signer: {
        format: 'ed25519-raw',
        public: '<your ledger public key>'
    }
})
 
await sdk.anchor.init()
    .data({
        handle: 'tel_123_account_usd',
        wallet: 'tel:123',
        target: 'account',
        symbol: 'usd',
        access: [...]
    })
    .hash()
    .sign([{ keyPair: yourKeyPair }])
    .send()
 
await sdk.anchor.init()
    .data({
        handle: 'tel_123_account2_usd',
        wallet: 'tel:123',
        target: 'account2',
        symbol: 'dop',
        access: [...]
    })
    .hash()
    .sign([{ keyPair: yourKeyPair }])
    .send()

Query wallet anchors

import { LedgerSdk } from '@minka/ledger-sdk'
 
const sdk = new LedgerSdk({
    server: '<your ledger URL>',
    signer: {
        format: 'ed25519-raw',
        public: '<your ledger public key>'
    }
})
 
const { anchors } = await sdk.wallet
    .getAnchors('tel:123')

We are also able to apply some filters for the target and/or for the symbol

import { LedgerSdk } from '@minka/ledger-sdk'
 
const sdk = new LedgerSdk({
    server: '<your ledger URL>',
    signer: {
        format: 'ed25519-raw',
        public: '<your ledger public key>'
    }
})
 
const { anchors } = await sdk.wallet
    .getAnchors('tel:123', {
        'data.target': 'account'
    })
import { LedgerSdk } from '@minka/ledger-sdk'
 
const sdk = new LedgerSdk({
  server: '<your ledger URL>',
  signer: {
		format: 'ed25519-raw',
		public: '<your ledger public key>'
	}
})
 
const { anchors } = await sdk.wallet
	.getAnchors('tel:123', {
		'data.symbol': 'usd'
  })

Anchors resolved by wallet bridge are also included in the response if the ledger is able to resolve a bridge for the address tel:123 . The bridge should implement anchors trait in order to receive this request. See About Bridges for more details about bridge anchors.

On this page