@marcoslobo/poma-nep9
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

neon-nep9

Overview

Poma-NEP9 plugin. Adds the package nep9 into poma-core.

  • Ability to parse an NEP9 compliant string into an easily consumable intent object

Installation

yarn i @marcoslobo/poma-nep9 @marcoslobo/poma-core
const neonCore = require("@marcoslobo/poma-core");
const nep9Plugin = require("@marcoslobo/poma-nep9");

const neonJs = nep9Plugin(neonCore);

module.exports = neonJs;

API

parse takes in a complete NEP9 URI string and returns an intent object:

import { nep9 } from "pomaJs";
const intent = parse(
  "poma:AeNkbJdiMx49kBStQdDih7BzfDwyTNVRfb?asset=gas&amount=123.456"
);

The intent will look like:

{
  address: "AeNkbJdiMx49kBStQdDih7BzfDwyTNVRfb",
  attributes:[], // defaults to empty array
  asset: "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7", // May be undefined
  amount: 123.456 // May be undefined
}
  • Known ASCII attributes (remarks and descriptions) are URI-decoded and transformed into hexstrings automatically.
  • Assets poma and gas are automatically transformed into their respective assetIds.
  • Runtime validation such as address and contract verifications are not performed during parsing.

Package Sidebar

Install

npm i @marcoslobo/poma-nep9

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

24.5 kB

Total Files

34

Last publish

Collaborators

  • marcoslobo