Neon-Invoker - A Neo3-Invoker implementation using Neon-JS
Made with ❤ by COZ.IO
npm i @cityofzion/neon-invoker
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,
})
The usage of NeonInvoker is documented in the Neo3-Invoker Docs.