Smart Contracts Guide

Tweed provides an SDK for multiple contract standards, so you can integrate NFT & Token Checkout with a few lines of code

Overview

Tweed allows integration with the following:

  • EVM

    • ERC-20, only for In-Platform Tokens

    • ERC-721

    • ERC-1155

  • Tezos

    • FA1.2, only for In-Platform Tokens

    • FA2

  • Solana

    • Non fungible tokens supported by the Token Program

    • Fungible tokens supported by the Token Program

Tweed SDK allows the seller to get integrated with Tweed's ecosystem in a frictionless and simple way through minimal code changes to their smart contracts that mint the NFTs.​

Your smart contracts need to support a "Mint-and-Send-to-Wallet" (claim) function, meaning the smart contract needs a trigger to mint an NFT and send it to an arbitrary wallet address. This trigger will be sent from a Tweed smart claimer and will be funded by Tweed infrastructure.

The next step will be to connect the contract with Tweed's backend using the Developer Console. The Developer Console will run several checks, and connect the contract to the billing system.

In the event the function returns an error, it will be shown to the user in the purchase widget.


The Claimers​

Tweed uses "claimers" to claim the NFT from the NFT minter contract. The claimers are deployed on the blockchains we support and your contract should whitelist the appropriate claimer address.


ABI (EVM)​

The claimers support ABI without any limitation. The default ABI has two parameters: toAddress (address) and tokenId (string). If there are more parameters than the default ones, they will be added in the customMintParams. The ABI can be obtained from the compiled smart contract.

Here is how to configure the default ABI for the following function: safeMint(toAddress address, tokenUri string) public payable returns (uint256)

abi: 'safeMint(toAddress address, tokenUri string)'

If there are more parameters, like in this example: safeMintWithThumbnail(toAddress address, tokenId string, thumbnailPath string) public payable returns (uint256) we will use the customMintPararms like this:

abi: "safeMintWithThumbnail(from address, toAddress address, thumbnailPath string)",
      customMintParams: {
        thumbnailPath: tPath
      }

Our GitHub example contains a full implementation of the checkout feature.

Last updated