1.0.61 • Published 2 years ago

flipeet-sdk v1.0.61

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

Flipeet

SDK for interacting with the flipeet contract to exchange Crypto assets between parties, data store, authentication and web3api.

unnamed

Authors

Badges

MIT License GPLv3 License AGPL License

Core Features

  • Create Sale
  • Create Offer
  • Sign Transfer Transactions
  • Execute Exchange

Data Store Features

  • Add Data
  • Get Data
  • Update Data
  • Delete Data
  • Basic Query

Authentication Features

  • Metamask Authentication
  • Walletconnet Authentication
  • Magic Link or Fortmatic Authentication
  • Web3Auth or Torus Authentication
  • Other functionalities

Web3 Protocol Features

  • Get NFTs
  • Get NFTs For Contract
  • Get Token Balance
  • Get Token Transfers
  • Get NFT Transfers
  • Get Contract NFT Transfers
  • Get NFT Transfers By Block
  • Get Token MetaData
  • Get Token Allowance
  • Get Token Price
  • Get NFT MetaData
  • Get NFT Owners
  • Get All Token Ids
  • Get Token Id MetaData
  • Get Token Id Owners
  • Search NFTs
  • Get Block

⭐️ Star us

If this Flipeet helps you - please star this project, every star makes us very happy!

🚀 Quick Start

Installation

Install flipeet-sdk with npm

  npm install flipeet-sdk
  cd my-project

Usage/Examples

Init

After installing the SDK, import the Flipeet class into your current script.

import Flipeet from 'flipeet-sdk';

// Initialize web3 using ethers.js
await window.ethereum.enable();
const provider = new ethers.providers.Web3Provider(window.ethereum, 'any');

// Moralis config
const config = {
  appId: '',
  serverUrl: '',
  masterKey: '',
};

// Initialize Flipeet
const flipeet = new Flipeet(provider, config);

🧭 Table of contents

🎯 Core Features

Sale

Creating a Sale

You can offer up a token or collection of tokes for sale (exchange) by using the sale() method. NB. Every created sales expires after two weeks.

const sale = flipeet.core.sale();

// Add a token to offer up for exchange
await sale.addToken({ quantity: '200', tAddress: '0xFD244E7f5A39845087D21825f87BEEf9eC79208a', tId: 1, tStandard: 1 });

// Make the sale visible to other users
await sale.publish();

Adding Multiple Tokens

You can add multiple tokens by repeatedly calling the addToken function:

const sale = flipeet.core.sale();
await sale.addToken({
  quantity: '100',
  tAddress: '0xFD244E7f5A39845087D21825f87BEEf9eC79208a',
  tId: 1,
  tStandard: 'ERC20',
});
await sale.addToken({
  quantity: '1',
  tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
  tId: 1,
  tStandard: 'ERC721',
});
await sale.addToken({
  quantity: '2',
  tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
  tId: 1,
  tStandard: 'ERC1155',
});

Loading an Existing Sale

To load an existing sale, call:

const sale = flipeet.core.sale(saleId);

Where no sale ID is passed in, flipeet creates a new instance of the Sale class.

Offer

Creating an Offer

You can offer up a token or collection of tokes for offer (exchange) by using the offer() method.

// Sale ID must be passed in. Should be the Id of the Sale that the offer will be created for
const offer = flipeet.core.offer(saleId);

// Add a token to offer up for exchange
await offer.addToken({ quantity: '200', tAddress: '0xFD244E7f5A39845087D21825f87BEEf9eC79208a', tId: 1, tStandard: 1 });

// Make the offer visible to other users
await offer.publish();

Adding Multiple Tokens

You can add multiple tokens by repeatedly calling the addToken function:

// Sale ID must be passed in. Should be the Id of the Sale that the offer will be created for
const offer = flipeet.core.offer(saleId);

await offer.addToken({
  quantity: '100',
  tAddress: '0xFD244E7f5A39845087D21825f87BEEf9eC79208a',
  tId: 1,
  tStandard: 'ERC20',
});
await offer.addToken({
  quantity: '1',
  tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
  tId: 1,
  tStandard: 'ERC721',
});
await offer.addToken({
  quantity: '2',
  tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
  tId: 1,
  tStandard: 'ERC1155',
});

Loading an Existing Offer

To load an existing offer, call:

const offer = flipeet.core.offer(saleId, offerId);

Sale ID must be passed in. Should be the Id of the Sale that the offer is created for Where no offer ID is passed in, flipeet creates a new instance of the Offer class.

Sign Transfer Transaction

Signing Offer Transfer Transaction

Whenever the .publish() method is called after making an offer, The user will be prompted to sign their transfer. Therefore, giving Flipeet the right to process the transfer of tokens on blockchain once the sale has been accepted.

// Make the sale visible to other users
await offer.publish();

Signing Sale Transfer Transaction

Approving an offer

When a preferred offer has been identified by the seller, he can approve the offer by calling:

sale.approveOffer(offerId, true);

On approving the offer, the creator of the sale (the user) will be prompted to sign their transfer. Therefore, giving Flipeet the right to process the transfer of tokens on blockchain. The first parameter is the Id of the offer to approve while the second parameter is an optional value indicating whether or not the transaction should be executed on the blockcahain.

Execute Transfer Transaction

sale.approveOffer(offerId, true);

From the above method, If set to true, the user will be prompted to execute the transation after signing, whereas, setting this value to false only returns the signature after the user has signed the transaction.

🛢 Data Store Features

Our SDK handles the data access layer to our database, you can interact with our database by using the methods in our data service.

Add Data

You can add datas to a database collection by simple calling the add data method and passing the appropriate parameters.

const className = 'Sales';
const data = {
  from: '0xioabufao0933',
  items: [
    {
      quantity: '100',
      tAddress: '0xFD244E7f5A39845087D21825f87BEEf9eC79208a',
      tId: 1,
      tStandard: 'ERC20',
    },
    {
      quantity: '1',
      tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
      tId: 1,
      tStandard: 'ERC721',
    },
    {
      quantity: '2',
      tAddress: '0x6E8095814Dbfb8765f603F82eaa4d8aB63234D2C',
      tId: 1,
      tStandard: 'ERC1155',
    },
  ],
  isOpen: true,
  chainId: 1,
};

const record = flpeet.datastore.addData(className, data);

className : The className is the name of the collection you are trying to write data to. NB. the system creates the collection if not exist. data : a key-value pair object contain the data to write.

Get Data

You can retrieve an object from an existing datas in a collection by using our get data method and passing the appropriate parameters.

const className = 'Sales';
const id = 'nOUyYvSt4F1beFRF44alG5UM';

const record = flpeet.datastore.getData(className, id);

className : The className is the name of the collection you are trying to read data from. id : the object Id of the object you are trying to read.

Update Data

You can update the record of an existing object in a collection by using our update data method and passing the appropriate parameters.

const className = 'Sales';
const id = 'nOUyYvSt4F1beFRF44alG5UM';
const data = {
  isOpen: false,
  from: '0x0111',
};

const record = flpeet.datastore.updateData(className, id, data);

className : The className is the name of the collection you are trying to write data to. id : the object Id of the object you are trying to read. data : a key-value pair object contain the data to write.

Delete Data

You can delete an existing object in a collection by using our delete data method and passing the appropriate parameters.

const className = 'Sales';
const id = 'nOUyYvSt4F1beFRF44alG5UM';

const record = flpeet.datastore.deleteData(className, id);

className : The className is the name of the collection you are trying to read. id : the object Id of the object you are trying to delete.

Basic Query

You can query a simple datas in a collection depending on the need by using our basic query method

const constraints: MoralisQueryContraints[] = [];
const sort: MoralisQuerySort = { by: 'asc', key: '' };
const limit = 2;

sort.by = 'asc'; // 'asc' or 'desc'
sort.key = 'createdAt'; // property to sort with

constraints.push({
  clause: 'equalTo', // clause
  key: 'from', // property to satisfy
  value: '0xioabufao0933', // value to test
});
constraints.push({
  clause: 'notEqualTo', // clause
  key: 'isOpen', // property to satisfy
  value: false, // value to test
});

const record = flpeet.datastore.basicQuery(className, constraints, sort, limit, useMasterKey);

className : The className is the name of the collection you are trying to read. constraints : An arrary of object of the contraint to satisfy, the following clause can be use in query ie. 'equalTo' | 'notEqualTo' | 'greaterThan' | 'lessThan' | 'lessThanOrEqualTo' | 'greaterThanOrEqualTo' sort: An object of the order sort with, the by property can either be 'asc' | 'desc' limit: Total number of records to retrieve. useMasterKey: To use masterKey for search, this is required when query senstive datas.

🚦 Authentication Feature

You can authenticate a user by using our flipeet authentication feature. Our SDK supports the following providers.

Metamask Authentication

To authenticate with metamask provider, call our authentication method and specify metamask as provider

const authenticatedUser = flipeet.auth.authenticate({ provider: 'metamask' });

This method returns an object with the authenticated user details.

Walletconnect Authentication

To authenticate with wallet connect provider, call our authentication method and specify wallet connect as provider

const authenticatedUser = flipeet.auth.authenticate({ provider: 'walletconnect' });

This method returns an object with the authenticated user details.

Web3Auth or Torus Wallet Authentication

To authenticate with web3 auth link provider, call our authentication method and specify web3Auth as provider. This provider require your client Id, generated from your Web3Auth dashboard and theme for the login popup.

const authenticatedUser = flipeet.auth.authenticate({
  provider: 'web3Auth',
  clientId: 'xxxxxxxxxxx',
  theme: 'light' | 'dark',
});

This method returns an object with the authenticated user details.

Magic Link or Fortmatic Wallet Authentication

To authenticate with magic link provider, call our authentication method and specify magic link as provider. This provider require your apiKey, generated from your magic dashboard and an email of the user to authenticate

const authenticatedUser = flipeet.auth.authenticate({
  provider: 'magic',
  apiKey: 'xxxxxxxxxxx',
  email: 'abc@example.com',
});

This method returns an object with the authenticated user details.

Other Functionalities

Linking accounts

A user can have multiple address accounts, in order to sync them to their profile. You can use our linkAccount account function

window.ethereum?.on('onAccountChanged', (accounts) => {
  const confirm = confirm('Are you sure, you want to link this account?');
  if(confirm){
    const [account] = accounts;
    await flipeet.auth.linkAccount(account);
  }
});

This call with link the new account address to the current user account.

Get Current User

You can get the details of the current logged in user by calling the get Current User function

const currentUser = await flipeet.auth.getCurrentUser();

Log Out

You can logout by calling the log out function

await flipeet.auth.logout();

🖼 Web3 Protocol Features

Get NFTs

NFT API gets all NFTs from the current user or address. Supports both ERC721 and ERC1155. Returns an object with the number of NFT objects and the array of NFT objects.

Options:

  • address (required): A user address (i.e. 0x1a2b3x...).
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { chain: 'matic', address: '0x...' };
const nfts = await flipeet.web3.getNFTs(options);

Example return

[
  {
    "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
    "token_id": "15",
    "contract_type": "ERC721",
    "owner_of": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
    "block_number": "88256",
    "block_number_minted": "88256",
    "token_uri": "string",
    "metadata": "string",
    "synced_at": "string",
    "amount": "1",
    "name": "CryptoKitties",
    "symbol": "RARI"
  }
]

Get NFTs For Contract

NFT API gets an object with the NFT count for the specified contract and an NFT array belonging to the given address for the specified contract.

Options:

  • address (required): The owner of a given token (i.e. 0x1a2b3x...).
  • token_address (required): Address of the contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { chain: 'matic', address: '0x...', token_address: '0x...' };
const nfts = await flipeet.web3.getNFTsForContract(options);

Example return

{
  "status": "SYNCING",
  "total": 2000,
  "page": 2,
  "page_size": 100,
  "result": [
    {
      "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "token_id": "15",
      "contract_type": "ERC721",
      "owner_of": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "block_number": "88256",
      "block_number_minted": "88256",
      "token_uri": "string",
      "metadata": "string",
      "synced_at": "string",
      "amount": "1",
      "name": "CryptoKitties",
      "symbol": "RARI"
    }
  ]
}

Get Token Balances

Retrieve all token balances of a current user or specified address. Returns an object with the number of tokens and the array of token objects (asynchronous).

Options

  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • address (optional): A user address (i.e. 0x1a2b3x...). If specified, the user attached to the query is ignored and the address will be used instead.
  • to_block (optional) : The block number on which the balances should be checked
const balances = await flipeet.web3.getTokenBalances();

*Example return

[
  {
    token_address: '0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09',
    name: 'Kylin Network',
    symbol: 'KYL',
    logo: 'https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c.png',
    thumbnail: 'https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c_thumb.png',
    decimals: '18',
    balance: '123456789',
  },
];

Get NFT Transfers

NFT API gets the NFT transfers. Returns an object with the number of NFT transfers and the array of NFT transfers.

Options:

  • address (required): A user address (i.e. 0x1a2b3x...).
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
  • direction (optional): The transfer direction. Available values : both, to, from . Default value : both.
  • order (optional): The field(s) to order on and if it should be ordered in ascending or descending order.
const options = { chain: 'bsc', address: '0x...', limit: '10' };
const transfersNFT = await flipeet.web3.getNFTTransfers(options);

Example return

{
  "total": 2000,
  "page": 2,
  "page_size": 100,
  "result": [
    {
      "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "token_id": "15",
      "from_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "to_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "value": "1000000000000000",
      "amount": "1",
      "contract_type": "ERC721",
      "block_number": "88256",
      "block_timestamp": "2021-06-04T16:00:15",
      "block_hash": "string",
      "transaction_hash": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "transaction_type": "string",
      "transaction_index": "string",
      "log_index": 0,
      "operator": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"
    }
  ],
  "block_exists": true
}

Get Contract NFT Transfers

NFT API gets an object with number of NFT transfers and an array with NFT transfers for a given token contract address.

Options:

  • address (required): The address of the token contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', chain: 'bsc' };
const nftTransfers = await flipeet.web3.getContractNFTTransfers(options);

Get NFT Transfers By Block

NFT API gets NFT transfers by block number or block hash

Options:

  • block_number_or_hash (required): The block hash or block number.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { chain: 'bsc', block_number_or_hash: '11284830' };
const NFTTransfers = await flipeet.web3.getNFTTransfersByBlock(options);

Example return

{
  "total": 2000,
  "page": 2,
  "page_size": 100,
  "result": [
    {
      "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "token_id": "15",
      "from_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "to_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "value": "1000000000000000",
      "amount": "1",
      "contract_type": "ERC721",
      "block_number": "88256",
      "block_timestamp": "2021-06-04T16:00:15",
      "block_hash": "string",
      "transaction_hash": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "transaction_type": "string",
      "transaction_index": "string",
      "log_index": 0,
      "operator": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"
    }
  ],
  "block_exists": true
}

Get Token MetaData

Returns metadata (name, symbol, decimals, logo) for a given token contract address (asynchronous).

Options:

  • address (required): The address or an array of addresses to get metadata for
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
//Get metadata for one token. Ex: USDT token on ETH
const options = {
  chain: 'eth',
  addresses: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
};
const tokenMetadata = await flipeet.web3.getTokenMetadata(options);

//Get metadata for an array of tokens. Ex: USDT and USDC tokens on BSC
const options = {
  chain: 'bsc',
  addresses: ['0x55d398326f99059ff775485246999027b3197955', '0x0a385f86059e0b2a048171d78afd1f38558121f3'],
};
const tokenMetadata = await flipeet.web3.getTokenMetadata(options);

Example result

  {
    address: "0x0a385f86059e0b2a048171d78afd1f38558121f3",
    name: "USD Coin on BSC",
    symbol: "USDC",
    logo: null,
    logo_hash: null,
    thumbnail: null,
    decimals: "6",
    block_number: "8242108",
    validated: 1,
    created_at: "2022-01-20T10:41:03.034Z",
  },
  {
    address: "0x55d398326f99059ff775485246999027b3197955",
    name: "Tether USD",
    symbol: "USDT",
    logo: null,
    logo_hash: null,
    thumbnail: null,
    decimals: "18",
    block_number: "8242108",
    validated: 1,
    created_at: "2022-01-20T10:41:03.034Z",
  },
];

Get Token Allowance

Returns the amount which the spender is allowed to withdraw from the spender (asynchronous).

Options

  • address (required): The address of the token contract
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • spender_address (required) : The address of the token spender
  • owner_address (required) : The address of the token owner
//Get token allowace on ETH
const options = {
  //token holder
  owner_address: '0xd1628228ffaede220cd583da5f9262355682210a',
  //uniswap v3 router 2 contract address
  spender_address: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45',
  //ENS token contract address
  address: '0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72',
};
const allowance = await flipeet.web3.getTokenAllowance(options);

Example return

{
  "allowance": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
}

Get Token Price

Returns the price nominated in the native token and usd for a given token contract address (asynchronous).

Options

  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • exchange (optional) : The factory name or address of the token exchange. Possible exchanges, for different chains are: ETH mainnet: uniswap-v3, sushiswap, uniswap-v2 BSC mainnet: pancakeswap-v2,pancakeswap-v1 Polygon mainnet:quickswap If no exchange is specified, all exchanges are checked (in the order as listed above) until a valid pool has been found. Note that this request can take more time. So specifying the exchange will result in faster responses most of the time.
    • address (required): The address of the token contract
  • to_block (optional) : Returns the price for a given blocknumber (historical price-data)
//Get token price on PancakeSwap v2 BSC
const options = {
  address: '0x42F6f551ae042cBe50C739158b4f0CAC0Edb9096',
  chain: 'bsc',
  exchange: 'PancakeSwapv2',
};
const price = await flipeet.web3.getTokenPrice(options);

Example result

{
  "nativePrice": {
    "value": "8409770570506626",
    "decimals": 18,
    "name": "Ether",
    "symbol": "ETH"
  },
  "usdPrice": 19.722370676,
  "exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
  "exchangeName": "Uniswap v3"
}

Get NFT Metadata

NFT API gets the contract level metadata (name, symbol, base token uri) for the given contract

Options:

  • address (required): The address of the token contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', chain: 'bsc' };
const metaData = await flipeet.web3.getNFTMetadata(options);

Example return

{
  "token_address": "0x2d30ca6f024dbc1307ac8a1a44ca27de6f797ec22ef20627a1307243b0ab7d09",
  "name": "KryptoKitties",
  "abi": "string",
  "supports_token_uri": 0,
  "synced_at": "string",
  "symbol": "RARI",
  "contract_type": "ERC721"
}

Get NFT Owners

NFT API gets an object with a number of NFT owners and an array with NFT metadata (name, symbol) for a given token contract address .

Options:

  • address (required): The address of the token contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', chain: 'bsc' };
const nftOwners = await flipeet.web3.getNFTOwners(options);

Example return

{
  "status": "SYNCING",
  "total": 2000,
  "page": 2,
  "page_size": 100,
  "result": [
    {
      "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "token_id": "15",
      "contract_type": "ERC721",
      "owner_of": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "block_number": "88256",
      "block_number_minted": "88256",
      "token_uri": "string",
      "metadata": "string",
      "synced_at": "string",
      "amount": "1",
      "name": "CryptoKitties",
      "symbol": "RARI"
    }
  ]
}

Get All Token Ids

NFT API gets an object with a number of NFTs and an array with NFT metadata(where available) for a given token contract address.

Options:

  • address (required): The address of the token contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', chain: 'bsc' };
const NFTs = await flipeet.web3.getAllTokenIds(options);

Example return

{
  "total": 2000,
  "page": 2,
  "page_size": 100,
  "result": [
    {
      "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
      "token_id": "15",
      "contract_type": "ERC721",
      "token_uri": "string",
      "metadata": "string",
      "synced_at": "string",
      "amount": "1",
      "name": "CryptoKitties",
      "symbol": "RARI"
    }
  ]
}

Get Token Id Metadata

NFT API gets data, including metadata (where available), for the given token id of the given contract address.

Options:

  • address (required): The address of the token contract.
  • token_id (required): The id of the token.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', token_id: '1', chain: 'bsc' };
const tokenIdMetadata = await flipeet.web3.getTokenIdMetadata(options);

Example return

{
  "token_address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
  "token_id": "15",
  "contract_type": "ERC721",
  "token_uri": "string",
  "metadata": "string",
  "synced_at": "string",
  "amount": "1",
  "name": "CryptoKitties",
  "symbol": "RARI"
}

Get TokenId Owners

NFT API gets an object with number of NFT transfers and an array with all owners of NFT items within a given contract collection (asynchronous).

Options:

  • address (required): The address of the token contract.
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { address: '0xd...07', token_id: '1', chain: 'bsc' };
const tokenIdOwners = await flipeet.web3.getTokenIdOwners(options);

Search NFTs

NFT API gets the NFT data based on a metadata search.

Options:

  • q (required): The search string parameter
  • filter (required): What fields the search should match on. To look into the entire metadata set the value to global. To have a better response time you can look into a specific field like name. Available values : name; description; attributes; global; name,description; name,attributes; description,attributes; name,description,attributes
  • chain (optional): The blockchain to get data from. Valid values are listed on the intro page in the Supported Blockchains
  • format (optional): The format of the token id. Available values : decimal, hex. Default value : decimal.
  • offset (optional): offset.
  • limit (optional): limit.
const options = { q: 'Pancake', chain: 'bsc', filter: 'name' };
const NFTs = await flipeet.web3.searchNFTs(options);

Example return

[
  {
    "token_id": "124436",
    "token_address": "0x3afa102b264b5f79ce80fed29e0724f922ba57c7",
    "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmVAD8v4s2SXF8FgjePqMdQ2GV5hE2isZnzxcrA36XcSDA/metadata.json",
    "metadata": "{\"name\":\"Pancake\",\"description\":\"The dessert series 1\",\"image\":\"ipfs://QmNQFXCZ6LGzvpMW9Q5PWbCrEnLknQrPwr2r8pbQAgzQ9A/4863BD6B-6C92-4B96-BF80-8020B2F7C3A5.jpeg\"}",
    "contract_type": "ERC721",
    "token_hash": "d03fe436e972bf9215d7bb8c64c4c556",
    "synced_at": null,
    "created_at": "2021-09-19T10:36:16.610Z"
  }
]
1.0.61

2 years ago

1.0.60

2 years ago

1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.49

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.46

2 years ago

1.0.45

2 years ago

1.0.44

2 years ago

1.0.43

2 years ago

1.0.42

2 years ago

1.0.41

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.38

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago