@kaddex/kaddex-sdk
v0.0.1
Published
Functional library for interacting with kaddex smart contracts on kadena chainweb blockchain via the pact-lang-api.
Downloads
22
Maintainers
Readme
:hammer_and_wrench: Kaddex SDK
The Kaddex SDK is a stand-alone library designed to assist developers when interacting with the protocol in any environment that can execute JavaScript, such as websites or node scripts.
INSTRUCTIONS
For general usage, refer to our documentation on gitbook:
https://docs.kaddex.com/kaddex-sdk/
SDK Developers (Contributors)
Getting started
First step, clone the repository, and change into the project directory
$ git clone https://github.com/roboswap-ai/kaddex-sdk.git
$ cd kaddex-sdk
Install NPM packages for local development
$ npm install
Duplicate the .env.example file for local development
$ cp .env.example .env
Now, you'll need to generate a local key pair for integration testing on the Kadena Chainweb testnet.
$ npm run keygen
Copy this key pair into your .env file.
Next, use the testnet faucet to send some Testnet KDA to your new public key (ensure you use the public key as the account name): https://faucet.testnet.chainweb.com/
Finally, you will need to transfer some coins to chain ID 0 in order to run the integration tests.
Open Chainweaver here: https://chainweaver.kadena.network/
Create a new Chainweaver account if necessary.
Ensure you are on the testnet in Chainweaver.
Click "Add Account" and paste your public key.
If your testnet faucet transaction is complete, you should already see your Testnet KDA deposited.
Click "Transfer" in order to send some coins to chain ID 0.
Wait for your transfer to complete and ensure Chainweaver shows your new balance on chain ID 0.
Now, you are ready to run the integration tests using your new keypair.
$ npm run test
All tests should pass. Otherwise, notify the repository owners! ;)
You should now be all set for local development. Congrats! :party-popper:
In order to test the end-to-end functionality on the testnet, run the test command with nock
disabled.
$ NOCK_OFF=true npm run test
Code Quality
We use eslint
.
You can run lint in two modes:
lint
$ npm run lint
lint with auto fixing
$ npm run lint:fix
Run the tests
We use mocha and chai with a mostly (but not strict) behavioral style for testing.
You can run the tests in three different contexts:
Single run
$ npm run test
Watch mode
$ npm run test:watch
Coverage
$ npm run test:coverage
Documentation
Documentation is using jsDoc and is available as html or markdown version.
To build the documentation in development, you need to run
$ npm run docs
License
MIT, see license file