npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@minka/ledger-sdk

v2.17.1

Published

SDK for Minka Ledger

Downloads

692

Readme

Minka Ledger SDK

An SDK for interacting with the Minka Ledger.

Getting started

Installation

Install this package by running:

npm install @minka/ledger-sdk

Basic usage

First, you need an instance of the LedgerSDK class, you can pass an options object with the required property server pointing to the ledger you want to use.

const ledger = new LedgerSdk({
  server: 'https://minka.inc..',
})

That ledger instance has different Clients and only one status method that returns the status of the ledger.

Note: Most of the methods in the entire SDK are asynchronous, meaning they return a promise you need to wait to be resolved by using async/await(preferred) functions or .then()` at the end of the methods chain.

  

Clients

Each entity of the ledger has its client, and those clients are properties of the LedgerSDK instance, for example, the client for signer will be returned in sdk.signer if you used the example below to connect to the ledger.

Available clients: ledger, symbol, wallet, intent, signer, effect and bridge.

Common client methods

All clients have common methods for listing (list), fetching (read) and initializing (init) entities

list

The list method allows you to fetch a list of the required entity, it has an optional object of type LedgerListParams as a param to pass pagination and filtering options to it. You can read more about it here

const output = await sdk.signer.list()
// output: MultipleRecordsResponse
read

The read method allows you to fetch a single record of the required entity, it has a required string param that is the handle you want to fetch.

const output = await sdk.signer.read('handle')
// output: SingleRecordResponse
init

the init method allows you to initialize a new record builder instance. record builders provide a more convenient way to work with the records by implementing methods to hash, sign, test and send them to the ledger. You can optionally pass the initial record to the init method, otherwise, it will be initialized with an empty record.

// Initialize a record builder for the signer entity
const emptySignerRecord = await sdk.signer.init()
/**
 * Send that record to the backend. Note this record will
 * return error because it's empty.
 */
const response = await emptySignerRecord.send()

Keep in mind that methods are chainable, so you can easily create a record as follows;

/**
 * "{}" represents valid data for the record
 * "keyPair" represents a valid key pair
 */
await sdk.signer.init({}).hash().sign([{ keyPair }]).send()