Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.
/ karmachain-js Public archive

An npm package providing the Karmachain node api to javascript clients

License

Notifications You must be signed in to change notification settings

karma-coin/karmachain-js

Repository files navigation

Karmachain.js

An npm package providing the Karmachain api to javascript clients and beyond. Public releases are published to npm.

Generating karmachain.json

  1. Run a local Karmachain node.

  2. From this repo root dir run the following to set the content of karmachain.json with metadata from a karmachain node:

yarn load:meta

Generating types

yarn generate

docs and tutorial

https://polkadot.js.org/docs/api/examples/promise/typegen/

Testing

  1. Run a local Karmachain node in verifier mode and with an enabled offchain worker.

  2. Run the tests

yarn test

Note that the tests config adds verifier and offchain keys using these commands so there's no need to manually run them.

curl --location 'http://localhost:9933/' \
--header 'Content-Type: application/json' \
--data '{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "author_insertKey",
    "params": {
        "key_type": "Veri",
        "suri": "//Alice",
        "public": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
    }
}'
curl --location 'http://localhost:9933/' \
--header 'Content-Type: application/json' \
--data '{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "author_insertKey",
    "params": {
        "key_type": "rewa",
        "suri": "//Alice",
        "public": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d"
    }
}'

Publishing

yarn publish