Minka Ledger Docs
How To Guides

How to set custom data to Ledger records

DateResponsibleChanges
September 7, 2022@Željko RumenjakInitial version
February 10, 2023@Omar MonterreySDK Options refactoring (url to server and key to signer)
February 27, 2023@Omar MonterreyRefactored signer.schemasigner.format
March 9, 2023@Tomislav HermanRefactored ledgersdk

Each ledger record supports attaching custom data through the custom property. This property can contain any key/value pairs that represent valid JSON. When making api requests using the SDK those fields can be added when constructing an object, for example when creating a wallet through nodeJS:

import { LedgerSdk } from '@minka/ledger-sdk'
 
const sdk = new LedgerSdk({
  server: '<your ledger URL>',
	signer: {
		format: 'ed25519-raw',
		public: '<ledger public key>'
	}
})
 
const { wallet } = await sdk.wallet.init()
  .data({
    handle: 'test-wallet',
    custom: {
      stringProperty: 'some string value',
      numberProperty: 134.2,
      booleanProperty: false,
    }
  })
  .hash()
  .sign([{ keyPair: yourKeyPair }])
  .send()

Custom data can be also added interactively through CLI:

$ minka wallet create
? Handle: test-wallet
? Bridge: [none]
? Add custom data? Yes
? Field class: string
? Field title: stringProperty
? Field value: some string value
? Add another field? Yes
? Field class: number
? Field title: numberProperty
? Field value: 134.2
? Add another field? Yes
? Field class: boolean
? Field title: booleanProperty
? Field value: false
? Add another field? No
? Add routes? No
? Signer: treasury
 
✅ Wallet created successfully:
Handle: test-wallet
Signer: MCowBQYDK2VwAyEAqySfsabYtxyEwAYtJQRv0NyRkfjC65hmZ9ZwnCmsso4= (treasury)
Custom:
 - stringProperty: some string value
 - numberProperty: 134.2
 - booleanProperty: true