New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gem-sdk

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gem-sdk

SDK providing access to Gem infrastructure

  • 0.0.6-rc.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

gem-sdk

npm install gem-sdk
const ethersProvider = new ethers(window.ethereum);

const gemInstance = new Gem(ethersProvider);

Test Cases

fork mainnet
ganache-cli --fork https://mainnet.infura.io/v3/infuraid

rename .env.example to .env and input required fields

npm test

batchBuyNft

const account = senders wallet address;

const paymentToken = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"; // ethereum
or
const paymentToken = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; // dai

in case of dai it will automatically approve dai.
in case of both eth and dai it will automatically check users balance.
you can use any currency the function will manage.

single asset buying

await gemNewInstance.batchBuyNfts(account, paymentToken, [
     {
          standard: "ERC1155",
          address: "0xa342f5d851e866e18ff98f351f2c6637f4478db5",
          tokenId:
            "53343204100803765692379285688171671302437967278842259121980540727210832568320",
          amount: 1,
     }
]);

multiple asset buying (single transaction)

await gemNewInstance.batchBuyNfts(account, paymentToken, [
      {
        standard: "ERC721",
        address: "0xf9d53e156fe880889e777392585feb46d8d840f6",
        tokenId: "993",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xf9d53e156fe880889e777392585feb46d8d840f6",
        tokenId: "3167",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xf75140376d246d8b1e5b8a48e3f00772468b3c0c",
        tokenId: "7085",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xe5545fa0636a82c0b37c7db62e2104e69a11d062",
        tokenId: "642",
        amount: 1,
      },
 ]);


await gemNewInstance.batchBuyNfts(account, paymentToken, [
      {
        standard: "ERC1155",
        address: "0x76be3b62873462d2142405439777e971754e8e77",
        tokenId: "10172",
        amount: 2,
      },
      {
        standard: "ERC1155",
        address: "0x76be3b62873462d2142405439777e971754e8e77",
        tokenId: "10391",
        amount: 2,
      },
      {
        standard: "ERC1155",
        address: "0x28472a58a490c5e09a238847f66a68a47cc76f0f",
        tokenId: "0",
        amount: 2,
      },
      {
        standard: "ERC721",
        address: "0xf9d53e156fe880889e777392585feb46d8d840f6",
        tokenId: "993",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xf9d53e156fe880889e777392585feb46d8d840f6",
        tokenId: "3167",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xf75140376d246d8b1e5b8a48e3f00772468b3c0c",
        tokenId: "7085",
        amount: 1,
      },
      {
        standard: "ERC721",
        address: "0xe5545fa0636a82c0b37c7db62e2104e69a11d062",
        tokenId: "642",
        amount: 1,
      },
]);

refer to this doc to use these ahead functions in detailed manner

https://drive.google.com/file/d/1YwZ7nradT_iS-BRNtz3EIdLAVBQav9Xq/view

getNftData

const data = await gemInstance.getNftData({
      nftAddress: "0x28472a58a490c5e09a238847f66a68a47cc76f0f",
      nftId: "0",
});

const fields = {
        name: 1,
        symbol: 1,
        standard: 1,
        description: 1,
        address: 1,
        createdDate: 1,
        externalUrl: 1,
        imageUrl: 1,
        totalSupply: 1,
        sevenDayVolume: 1,
        oneDayVolume: 1,
        stats: 1,
        traits: 1,
        indexingStatus: 1,
        discordUrl: 1,
        instagramUsername: 1,
        isVerified: 1,
        lastNumberOfUpdates: 1,
        lastOpenSeaCancelledId: 1,
        lastOpenSeaSaleCreatedId: 1,
        lastOpenSeaTransferId: 1,
        lastRaribleAssetUpdateId: 1,
        mediumUsername: 1,
        telegramUrl: 1,
        twitterUsername: 1,
        updatedAt: 1,
        wikiUrl: 1,
      }

getCollectionData


 sdk is using this api from the doc

 https://gem-public-api.herokuapp.com/collections

 const data = await gemInstance.getCollectionData({
      sort: { sevenDayVolume: 1 },
      limit: 1,
      fields: fields, // by default if you dont have fileds key in object it will take automatically take above fields object
    });

getFilteredData


the sdk is using this api https://gem-public-api.herokuapp.com/collections with filter field is here

const data = await gemInstance.getCollectionData({
      filters: { address: "0x50f5474724e0ee42d9a4e711ccfb275809fd6d4a" },
      limit: 1,
      fields: fields,
    });

    const data = await gemInstance.getCollectionData({
      sort: { sevenDayVolume: 1 },
      filters: { searchText: "bored" },
      limit: 1,
      fields: fields,
    });
const assetFields = {
    "id": 1,
    "name": 1,
    "address": 1,
    "collectionName": 1,
    "collectionSymbol": 1,
    "externalLink": 1,
    "imageUrl": 1,
    "smallImageUrl": 1,
    "animationUrl": 1,
    "standard": 1,
    "decimals": 1,
    "market": 1,
    "currentBasePrice": 1,
    "paymentToken": 1,
    "marketUrl": 1,
    "marketplace": 1,
    "tokenId": 1,
    "priceInfo": 1,
    "tokenReserves": 1,
    "ethReserves": 1,
    "url": 1,
    "sellOrders": 1
};

getAssetData


the sdk is using this api https://gem-public-api.herokuapp.com/assets from the doc

const data = await gemInstance.getAssetData({
      filters: {
        address: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d",
      },
      // { "field name": "asc" or "desc"}, you can sort by multiple fields
      sort: { currentEthPrice: "asc" },
      // { "field name": 1 (include field) or -1 (ignore field) }
      fields: assetFields, // by default if you dont have fileds key in object it will take automatically take above assetFields object
      limit: 10,
      offset: 0,
      markets: ["opensea", "rarible", "nftx", "nft20","larvalabs"],
    });

FAQs

Package last updated on 24 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc