@mintology/mintology-client v0.0.8
Mintology Client SDK
Mintology SDK for JavaScript Client.
Install
NPM
$ npm install @mintology/mintology-client --saveYarn
$ yarn add @mintology/mintology-clientHow to use
import Mintology from '@mintology/mintology-client';
const mintology = new Mintology({
projectId: 'project-id-from-mintology-dashboard',
});How to configure
You can pass configuration along with projectId, Please check the source to check supported options.
envis an environment specification, The default environment is production (prod).signUpApiEndpointis an endpoint where Mintology backend signup configured.pluginsis an array of Mintology Client Plugins. Checkout the Plugins.
const mintology = new Mintology({
env: 'dev',
projectId: 'project-id-from-mintology-dashboard',
signUpApiEndpoint: 'https://example.com/api/signup',
plugins: [new MintologyPluginUi()],
});Available methods
These are the methods currently supported.
Plugins
Here are some plugins to enhance the client experience.
Authorize
This method is used to check if a user owns a particular token (or any token of a particular collection). If you do not specify a contract_address, we will use the contract associated with your project. If you do not specify a token_id, we will check if the wallet contain any token from the contract.
await mintology.authorize({
email: 'example@yourorganization.com',
});These are the following attributes accepted by this method.
contract_addressThe Contract address to check. This is the address of the NFT contract that minted the token and it is optional; if this parameter is absent, the project contract address will be used instead.token_idToken Id to check. This is the token id of the specific NFT token within the contract and it is optional; if absent, any token from the contract will authorize the wallet.emailThe email address of the user whose wallet you want to verify
await mintology.authorize({
token_id: 'example-token-id',
email: 'example@yourorganization.com',
contract_address: '0xb44753fb732b70201a80f34857236bd84963825a',
});These are the following response attributes.
authorizedis a boolean indicating whether the claim was authorized
{
authorized: boolean;
}Claim
This method will mint a free NFT to your user's wallet (which can be a Mintable Wallet, or their existing crypto wallet). This is the endpoint you should use for discount coupons, proof of attendance, and in general NFTs which you do not intend to sell.
Note: Separating the mint and claim methods will allow you to clearly identify the purpose of each call in your analytics.
await mintology.claim({
email: 'example@yourorganization.com',
});These are the following attributes accepted by this method.
metadataOptional metadata to associate with minted token, if you don't have a pre-minted NFT in the dashboard, you need to pass in your own metadata to use.emailThe email address of the recipient (we'll look up the wallet address for you, or create one if required)
await mintology.claim({
email: 'example@yourorganization.com',
metadata: {
image: 'https://www.example.com/yournft.png',
name: 'Example',
},
});These are the following response attributes.
token_idis a string indicating token id of the claimed token
{
token_id: string;
}See Also
License
MIT © Mintable PTE LTD