Processing Mint IDRX Requests
The typical flow to process mint requests from your user
import { createSignature } from "./createSignature";
const axios = require('axios');
const apiKey = "{YOUR API KEY}";
const secret = "{YOUR SECRET}";
async function mintRequest() {
const path = "https://idrx.co/api/transaction/mint-request";
const req = {
"toBeMinted" : "51500",
"destinationWalletAddress" : "0x8BD53F7fF88fD895D3686fe6369a07432822d30F",
"expiryPeriod" : 3600, // 1 hour
"networkChainId" : "137", // Polygon
"requestType" : "idrx", // 'idrx' or empty to receive IDRX, 'usdt' to receive USDT
};
const bufferReq = Buffer.from(JSON.stringify(req), 'base64').toString('utf8');
const timestamp = Math.round((new Date()).getTime()).toString();
const sig = createSignature('POST', path, bufferReq, timestamp, secret);
const res = await axios.post(path, req, {
headers: {
'Content-Type': 'application/json',
'idrx-api-key': apiKey,
'idrx-api-sig': sig,
'idrx-api-ts' : timestamp,
},
});
console.log('res.data: ');
console.log(res.data);
}
mintRequest();Last updated
