0.0.8 • Published 2 years ago

@mintology/mintology-client v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Mintology Client SDK

Mintology SDK for JavaScript Client.

Install

NPM

$ npm install @mintology/mintology-client --save

Yarn

$ yarn add @mintology/mintology-client

How 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.

  • env is an environment specification, The default environment is production (prod).
  • signUpApiEndpoint is an endpoint where Mintology backend signup configured.
  • plugins is 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_address The 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_id Token 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.
  • email The 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.

  1. authorized is 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.

  • metadata Optional 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.
  • email The 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.

  1. token_id is a string indicating token id of the claimed token
{
  token_id: string;
}

See Also

License

MIT © Mintable PTE LTD

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago

1.0.0

2 years ago