<aside> 🔷 This API is intended to be used via a bot or a website for integrating token minting onto your own app. Please contact us on discord for an api key or issues. Note that this is still under development & needs refinement.
</aside>
Get access id and private key
POST [<https://api.coinvise.co/auth/api-key>](<https://api.coinvise.co/auth/api-key>)
Install the SDK from npm
npm instal coinvise
or yarn add coinvise
Initialise the SDK
// ES6 import
import { Coinvise } from 'coinvise';
// CommonJS import
const { Coinvise } = require("coinvise");
const coinvise = new Coinvise({
accessId: "your-access-id",
privateKey: "your-private-key",
});
To update webhook url (important for receiving events when user successfully mints token)
await coinvise.webhook.changeUrl({
webhookUrl: ''
})
const secret = await coinvise.webhook.generateSecret()
save the above secret to verify the webhook payload
To initiate a mint process
await coinvise.token.mint({
name: "test",
symbol: "TEST",
chainId: 1,
minterAddress: "0x33d73cc0E060939476A10E47b86A4568c7DcF261",
});
Output:
{
"data": {
"name": "test",
"symbol": "TEST",
"minterAddress": "0x33d73cc0E060939476A10E47b86A4568c7DcF261",
"chainId": 1,
"userId": "ckovv58ct0000157k5pik7k4u",
"id": "ckoxegkic0000jr7k1mag84lz",
"address": null,
"txHash": null,
"createdAt": "2021-05-20T21:22:09.490Z",
"updatedAt": "2021-05-20T21:22:09.490Z",
"decimals": 18,
"minted": false,
"finishUrl": "<https://bot.coinvise.co/mint-token?tokenId=ckoxegkic0000jr7k1mag84lz>"
},
"message": "created"
}
finishUrl
to let the user complete the minting of the tokenSuccessful Mint webhook
POST
request will be send to the configured webhook url{
"id": "ckpa2a5za0001if7kd61z24uy",
"name": "test",
"symbol": "TEST",
"minterAddress": "0x33d73cc0E060939476A10E47b86A4568c7DcF261",
"chainId": 1,
"address": "0x1FBe213b8dBb6DFc9cB4b12875df9722C563b663",
"txHash": "0x78e0c90edfcf4ac7238203538dff34ed7a4f9ef48a16c7e1e118cd73090658ab"
}
const isVerified = coinvise.webhook.verify({
secret: "whsec_...",
header: "", // value of "x-coinvise-webhook-signature" request header
payload: JSON.stringify(payload), // raw payload
})