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

@moxchain/sdk

v1.2.3

Published

Mox sdk is a set of libraries and solutions developed to create applications using the møx chain

Downloads

3

Readme

MØX SDK

Mox sdk is a set of libraries and solutions developed to create applications using the møx chain

Available modules

We recommend that you read the features of each module and how they can help you

  • Account Responsible for account and subscription management
  • Transaction Responsible for transaction management
  • Node Used to retrieve information from the blockchain
  • Admin Admin utilities, like set webhook url to be advised about new events in blockchain
  • Context Context related functions
  • Actor Actor related functions
  • Item Items related functions
  • Balances MØX Balances related functions
  • Storage Use to get access to blockchain storage

Quick start

Initialize your SDK

To initialize your SDK, you will need a url to access the mox service, which can be acquired by contacting us through our social networks. Soon we will provide a public access url

  import mox from 'mox-sdk'

  const sdk = await mox({
    network: 'aquarium', // aquarium for developers network; testnet for testnet network; main for production network
    serviceUrl: 'https://mox.service.url.example.com/'
  })

Create new key pair

With mox sdk you can create new mnemonic to generate key pairs, so the first step is to generate a mnemonic for the user

const mnemonic = sdk.account.createMnemonic()

If you already have a mnemonic, just add it to the sdk with the following function

sdk.account.setMnemonic('your mnemonic here')

then you must enable this account using the function

sdk.account.enableAccountByMnemonic()

to return your public key, just use

const publicKey = sdk.account.publicKey()

There are other ways to create accounts and initialize them, please check the account module

Create new transaction

MØX has a series of entities that can be used for gamification, each of these entities has its own module in the sdk, let's create a new context to see how transactions work

Read more about mØx entities on our website

Let's access the context module and call the create context function

  const context = await sdk.context.createContext(
    "My Context", // Context identifier can be any string that will be converted to a hash to become your context id
    100 // Era period means that this transaction has to be propagated in a maximum of 100 blocks after its creation 
  );

  const {
    utx, // This is the unsigned transaction that you will use to propagate this context to network
    contextId
  } = context

Ok, the function inside the context module returns to you an unsigned transaction, now we need sign it and propagate the transaction

  // we convert the unsigned transaction to an signable payload
  const signPayload = sdk.transaction.signPayload(utx);
  // using the account module with the instantiates account we create a signature
  const signature = sdk.account.sign(signPayload)
  // We put all together
  const transaction = sdk.transaction.constructSignedTx(utx, signature)
  // and send to network
  const hash = await sdk.node.submitTx(transaction)

  // OR you can use short version

  const hash = await sdk.transaction.signAndSendTransaction(utx)

Access the blockchain storage

After we create our context and entities below it, we will eventually have to access blockchain storage to retrieve data on actors, items, attributes, and so on. The storage module concentrates all these actions

  const contextData = await sdk.storage.getContext(contextId)

Where to use MØX sdk?

If your system allows it, prefer to use it in front end applications, as the sdk works primarily offline so that users have the security that no private information will be leaked. But don't trust us, check the above code for yourself.