Issuer Toolkit Library
The Issuer Toolkit is a javascript package that exposes a function that abstracts the generation of the minting contract parameters and minting of the actual Passport NFT without in-depth knowledge of the underlying Quadrata protocol.
Setup
Install the npm package or add the package to your package.json file:
npm install @quadrata/issuer
Call mintPassport()
The mintPassport() function is exposed and will mint a passport if the submitted parameters are correct. It is important to note that the attributes object will check against valid attribute names as keys.
import { mintPassport } from '@quadrata/issuer';
import QUAD_PASSPORT_ABI from '@quadrata/contracts/abis/QuadPassport.json';
// NOTE: Please keep your private key secure (i.e. SSM)
const ISSUER_PRIVATE_KEY = '';
export const MintPassport: React.FC = () => {
const handleSubmit = async (
aml,
account,
did,
fee,
tokenId,
chainId,
providerUrl,
passportAddr,
event
) => {
// Prevent form submission
event.preventDefault();
// Mint passport on-chain
const tx = await mintPassport({
did: did,
fee: fee,
tokenId: tokenId,
chainId: chainId,
issuedAt: Math.floor(new Date().getTime() / 1000 - 100).toString(),
verifiedAt: Math.floor(new Date().getTime() / 1000 - 100).toString(),
attributes: { AML: aml },
providerUrl: providerUrl,
passportAddr: passportAddr,
targetWalletAddr: account as BytesLike,
issuerPrivateKey: ISSUER_PRIVATE_KEY,
passportAbi: QUAD_PASSPORT_ABI,
});
}
Last updated