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

m10-sdk

v0.34.0

Published

M10 SDK

Downloads

7

Readme

M10-SDK

The M10 (SDK) gives you access to the M10 APIs allowing you to build custom clients and banking integrations with the M10 Platform. Whether you are a central bank implementing custom applications, or a new Fintech who wants to build atop an M10 CBDC, the SDK is your first stop.

The M10-SDK is documented primary using TypeDoc (use yarn run docs to generate them) and examples in the tests.

Installation & Requirements

Run yarn install for a node version >16.

Using the SDK

Create an instance of the SDK and pass it the URL of your ledger Directory, specifying TLS:

const sdk = require("m10-sdk");

const ledgerUrl = "develop.m10.net";
const ledgerClient = new sdk.client.LedgerClient(ledgerUrl, true);

Setup signer based on the key:

const bankAdmin = "MC4CAQAwBQYDK2VwBCIEIIrikV/M3erX0lqmQgVXDRU1yFLStge7RyyvXv+kDesK";
const bankAdminSigner = sdk.signer.CryptoSigner.getSignerFromPkcs8V1(bankAdmin);

Make a request:

  • Query request example which shows how to list accounts with bankAdmin as an owner:

    const request = { owner: bankAdminSigner.getPublicKey() };
    const response = await ledgerClient.listAccounts(bankAdminSigner, request);
  • Transaction request example of creating an account:

    const { m10 } = require("m10-sdk/protobufs");
    
    const account = new m10.sdk.model.Account({
        id: utils.getUint8ArrayFromAccountId(accountId),
        name: "Name",
        publicName: "Some Public Name",
        owner: bankAdminSigner.getPublicKey(),
    });
    const transactionData = sdk.collections.getCreateTransactionDataFromDocument(
        m10.sdk.model.Account.encode(account).finish(),
        sdk.collections.Collection.Account,
    );
    
    const request = ledgerClient.transactionRequest(transactionData);
    const response = await ledgerClient.createTransaction(signer, request);

We also have some helpers, but it's better not to rely on them and use them only as an example to create your own.

Protobufs

Protobufs are generated using yarn run proto script, for this to work you need to have dependencies installed (yarn install) and have necessary proto files in ../../protobuf folder.

Tests

Tests are split into two parts:

  • tests/integration will give you some examples on how to implement certain functionality
  • tests/* are used for testing all actions separate without context

All of them can be run using yarn run test, or yarn run test:cover which will generate coverage reports (with html one saved in coverage folder).

Support

If you have any issues with using the SDK, please file an issue on Github