@zerowood/camn-cac21
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

neon-nep9

Overview

Neon-NEP9 plugin. Adds the package nep9 into neon-core.

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

Installation

yarn i @cityofzion/neon-nep9 @cityofzion/neon-core
const neonCore = require("@cityofzion/neon-core");
const nep9Plugin = require("@cityofzion/neon-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 "neonJs";
const intent = parse(
  "neo: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 neo 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 @zerowood/camn-cac21

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

25.5 kB

Total Files

35

Last publish

Collaborators

  • zerowood