Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Latest commit

 

History

History
63 lines (44 loc) · 1.78 KB

README.md

File metadata and controls

63 lines (44 loc) · 1.78 KB

Neon-Invoker - A Neo3-Invoker implementation using Neon-JS
Made with ❤ by COZ.IO

Neon-Invoker

Install

npm i @cityofzion/neon-invoker

Initialize NeonInvoker

To use NeonInvoker as a Neo3Invoker you can simply call NeonInvoker.init and pass the NeonInvoker instance to the SDK that requires a Neo3Invoker.

To sign the transactions you should pass an account to the NeonInvoker.init method. You can use the Account class from @cityofzion/neon-core to create an account.

import { NeonInvoker } from '@cityofzion/neon-invoker'
import { default as Neon } from '@cityofzion/neon-js'

const account = Neon.create.account('NKuyBkoGdZZSLyPbJEetheRhMjeznFZszf')

const neonInvoker: Neo3Invoker = await NeonInvoker.init({
  rpcAddress: NeonInvoker.MAINNET,
  account,
})

You can also pass an signingCallback to the NeonInvoker.init method. It should return a Promise of signature string. See here an example implementation of ledger signature.

If you don't want to sign, simply don't pass an account.

import { NeonInvoker } from '@cityofzion/neon-invoker'

const neonInvoker: Neo3Invoker = await NeonInvoker.init({
  rpcAddress: NeonInvoker.MAINNET,
})

You can also pass a custom RPC endpoint to the NeonInvoker.init method.

Another example of initialization is:

const neonInvoker: Neo3Invoker = await NeonInvoker.init({
  rpcAddress: 'http://127.0.0.1:5001',
  account,
})

Usage

The usage of NeonInvoker is documented in the Neo3-Invoker Docs.