💀 This is a Work in Progress.
Current status: Common PoC data storage and methods available. Partially tested.
Use at your own risk.
OCEX smartcontract api for interaction with an OCEX smartcontract.
- For Owners
- publish new instance of a contract to a blockchain
- top-up balance of an instantiated contract
- add new coupons
- burn coupons
- check spare funds on a smartcontract
- withdraw spare funds
- transfer ownership of a contract
- For Clients
- activate a coupon
- сheck a coupon
yarn add https://github.com/bsn-si/ocex-api
# or
npm i --save https://github.com/bsn-si/ocex-api
Simple node usage
import { cryptoWaitReady } from "@polkadot/util-crypto"
import { ApiPromise, WsProvider } from "@polkadot/api"
import { Keyring } from "@polkadot/keyring"
// Import contract api class
import { Ocex } from "ocex-api"
async function main() {
await cryptoWaitReady()
const keyring = new Keyring({ type: "sr25519" })
// Initialise the provider to connect to the local node
const provider = new WsProvider("ws://127.0.0.1:9944")
const client = await ApiPromise.create({ provider })
// Common owner keys
const signer = keyring.addFromUri("//Alice")
console.log("Signer: ", signer.address)
// Instance from exists contract address
const contract = await Ocex.fromAddress(client, signer, "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty")
// Other actions..
}
For more detauls check out our example of usage. For run example:
npm run run:example
Now module doesn't have package on npm, and have dependency of wasm module. You need install package by your target & assign method to class instance.
# Package for use from nodejs
yarn add https://gitpkg.now.sh/bsn-si/ocex-coupon-signature/pkg_node?main
# Package for use from web (with webpack)
yarn add https://gitpkg.now.sh/bsn-si/ocex-coupon-signature/pkg_web?main
And for initialization
// Import for nodejs
import { get_coupon_signature } from "ocex-coupon-signature-node"
// Import for web with webpack
import { get_coupon_signature } from "ocex-coupon-signature-web"
// ...
const contract = await Ocex.fromAddress(client, signer, "...")
// Setup method for create signature
contract.get_coupon_signature = get_coupon_signature
- OCEX coupon activation dapp
- OCEX Ink! smart contract
- OCEX CLI management tool
- JS/Wasm library for coupon activation signatures
Apache License 2.0 © Bela Supernova (bsn.si)