@figmentio/slate
v1.22.0
Published
Node.js library for interacting with Slate from Figment
Downloads
66
Maintainers
Keywords
Readme
slate-node
Node client for Slate, initially for decoding transaction payloads
Usage
Decoding a transaction to validate inputs
The main decoding method is called using the decode method as follows
const slate = require('@figmentio/slate')
slate.decode('<network_code>', '<operation>', '<version>', '<transaction_type>', '<transaction_payload>')
Where (see list below for possible values for each field)
<network_code>
: name of the network<operation>
: the operation the transaction is built to accomplish<version>
: the Slate API version number used to generate the transaction<transaction_type>
: the type of transaction being decoded<transaction_payload>
: the raw, unsigned transction payload returned by Slate
Using a Solana staking Flow and the createStakeAccountTransacion
transaction type, you would use the following:
const slate = require('@figmentio/slate')
slate.decode('solana', 'staking', 'v1', 'createStakeAccountTransaction', 'transaction-payload-goes-here')
Available Networks, Operations, and Transaction Types
- solana
- staking
- createStakeAccountTransaction
- delegateTransaction
- unstaking
- deactivateTransaction
- withdrawTransaction
- transfer
- transferTransaction
- mergeStakeAccount
- mergeTransaction
- splitStakeAccount
- splitTransaction
- staking
- ethereum
- staking
- depositTransaction
- staking
- polkadot
- staking
- bondingTransaction
- nominationTransaction
- unstaking
- chillTransaction
- unbondTransaction
- withdrawTransaction
- transfer
- transferTransaction
- addProxy
- addProxyTransaction
- removeProxy
- removeProxyTransaction
- staking
- near
- staking
- delegateTransaction
- unstaking
- undelegateTransaction
- withdrawTransaction
- transfer
- transferTransaction
- staking
- avalanche
- staking
- delegateTransaction
- staking
- cosmos
- claimRewards
- withdrawTransaction
- redelegate
- redelegateTransaction
- staking
- delegateTransaction
- transfer
- transferTransaction
- unstaking
- undelegateTransaction
- claimRewards
- cardano
- staking
- registerTransaction
- delegateTransaction
- unstaking
- deregisterTransaction
- transfer
- transferTransaction
- staking
Signing a transaction
This client can also be used to sign transaction payloads. This functionality can be called as follows where <signing_private_keys>
is an array containing all the private keys required for signature and <transaction_payload>
is the raw, unsigned transction payload returned by Slate.
const slate = require('@figmentio/slate')
await slate.sign('<network_code>', '<version>', '<transaction_payload>', `<signing_private_keys>`)
Versioning
We use semantic versioning to manage the version for this package.
Summary
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backwards compatible manner
- PATCH version when you make backwards compatible bug fixes
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
Production release
To release slate-node to production we're packaging it through npmjs https://www.npmjs.com/package/@figmentio/slate
- First go to the
package.json
file and bump up the version according to semversion best practices - go to Releases page on Github and click on "Draft a new release"
- use the same version/tag from the
package.json
- the Release title should be the same as tag
- add some bullet-points that would describe the most important features/changes included in the release
- click "Publish release"
This will trigger an action to release the package to npmjs
Testing
Run the tests via:
yarn test