{"id":20791572,"url":"https://github.com/nftgo/gotrading","last_synced_at":"2025-04-12T21:33:46.952Z","repository":{"id":179439808,"uuid":"578975672","full_name":"NFTGo/GoTrading","owner":"NFTGo","description":"The all-in-one solution for NFT trading aggregators, marketplaces, automated trading and market makers.","archived":false,"fork":false,"pushed_at":"2025-01-02T10:54:05.000Z","size":73643,"stargazers_count":175,"open_issues_count":2,"forks_count":66,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-04T01:09:09.840Z","etag":null,"topics":["aggregator","ethereum","marketplace","nft","nonfungible","nonfungibletoken","sdk","token","trading","web3"],"latest_commit_sha":null,"homepage":"https://developer.nftgo.io","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NFTGo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-16T10:48:56.000Z","updated_at":"2025-03-28T08:17:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8138071-b101-4f40-a5a7-377c9db64b1a","html_url":"https://github.com/NFTGo/GoTrading","commit_stats":{"total_commits":118,"total_committers":10,"mean_commits":11.8,"dds":0.652542372881356,"last_synced_commit":"65d7e5db05c4b271d88b4b6e518d9f7f24236212"},"previous_names":["nftgo/gotrading","nftgo/gotrading-js"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFTGo%2FGoTrading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFTGo%2FGoTrading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFTGo%2FGoTrading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NFTGo%2FGoTrading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NFTGo","download_url":"https://codeload.github.com/NFTGo/GoTrading/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248635652,"owners_count":21137273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aggregator","ethereum","marketplace","nft","nonfungible","nonfungibletoken","sdk","token","trading","web3"],"created_at":"2024-11-17T15:45:35.018Z","updated_at":"2025-04-12T21:33:46.926Z","avatar_url":"https://github.com/NFTGo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoTrading-js\n[![node](https://img.shields.io/badge/node-%3E%3D%2016.14-brightgreen.svg)](https://nodejs.org/en/) [![Discord][discord-image]][discord-url] [![Twitter][twitter-image]][twitter-url]\n\n# Table of Contents\n- [GoTrading-js](#gotrading-js)\n- [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Key Features](#key-features)\n  - [Supported Marketplaces](#supported-marketplaces)\n  - [Supported Chains](#supported-chains)\n  - [Requirements](#requirements)\n  - [Quickstart](#quickstart)\n    - [1. Install the SDK.](#1-install-the-sdk)\n    - [2. Import and init the GoTrading SDK.](#2-import-and-init-the-gotrading-sdk)\n    - [3. Fulfill Listings](#3-fulfill-listings)\n  - [SDK Core Methods](#sdk-core-methods)\n    - [Marketplace](#marketplace)\n      - [Create Listings](#create-listings)\n      - [Create Offers](#create-offers)\n      - [Fulfill Listings](#fulfill-listings)\n      - [Fulfill Offers](#fulfill-offers)\n      - [Cancel Orders](#cancel-orders)\n    - [OrderFetcher](#orderfetcher)\n      - [Get Orders By Contract](#get-orders-by-contract)\n      - [Get Orders By NFT](#get-orders-by-nft)\n      - [Get Orders By Ids](#get-orders-by-ids)\n      - [Get Orders By Maker](#get-orders-by-maker)\n    - [Utils](#utils)\n  - [Questions \\\u0026 Feedback](#questions--feedback)\n  - [License](#license)\n\n## Introduction\n\n\u003c!-- Introduction --\u003e\n\nGoTrading is an open-source development kit that enables you to build your own NFT trading aggregator and marketplace. The SDK provides a comprehensive set of tools and APIs that greatly simplify the development process of a general trading aggregator like Gem.xyz or Blur.io, and allows developers to access real-time order feed and NFT transaction data. With the SDK, you can easily aggregate orders and functionality from mainstream marketplaces such as Opensea, Looksrare, Blur, x2y2, Sudoswap, etc, all in your products and communities.\n\n## Key Features\n - Simple and easy-to-use API\n - Real-time market data access\n - Code is easy to customize and extend\n - Supports Bulk Listing and Bulk Buying\n\n## Supported Marketplaces\nGoTrading currently aggregates the following marketplaces, and we will continue to add more marketplaces in the future.\n\n| **Marketplace** | **Create Listings** | **Fulfill Listings** | **Create Offers** | **Fulfill Offers** | **Cancel Listings/Offers** | **Protocol**                      |\n| --------------- | ------------------- | -------------------- | ----------------- | ------------------ | -------------------------- | --------------------------------- |\n| OpenSea         | Yes                 | Yes                  | Yes               | Yes                | Yes                        | seaport-v1.5                      |\n| Blur            | Yes                 | Yes                  | Yes               | Yes                | Yes                        | blur                              |\n| LooksRare       | Yes                 | Yes                  | Yes               | Yes                | Yes                        | looksrare-v2                      |\n| X2Y2            | Yes                 | Yes                  | Yes               | Yes                | Yes                        | x2y2                              |\n| Sudoswap        | No                  | Yes                  | No                | Yes                | No                         | sudoswap/sudoswap-v2              |\n| CryptoPunks     | No                  | Yes                  | No                | Yes                | Yes                        | cryptopunks                       |\n| Artblocks       | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| Reservoir       | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| ENSVision       | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| Magically       | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| Alienswap       | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| Ordinals        | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| Sound           | No                  | Yes                  | No                | Yes                | Yes                        | seaport-v1.5                      |\n| NFTGO           | Yes                 | Yes                  | Yes               | Yes                | Yes                        | seaport-v1.5/payment-processor-v2 |\n\n\n\n## Supported Chains\nGoTrading currently supports the following chains:\n- Ethereum Mainnet\n- Sepolia Testnet ( Comming Soon )\n- Polygon Mainnet ( Comming Soon )\n\n\n\n## Requirements\n- Node.js \u003e= 16.14\n- web3 \u003e= 1.8.2\n- ethers \u003e= 5.6.9, \u003c 6.1\n\nYou can do this by running the following commands:\n```bash\nnpm install web3 ethers@5.6.9\n```\n\n## Quickstart\n### 1. Install the SDK.\n\n\u003e With `npm` :\n```bash\nnpm install @nftgo/gotrading\n```\n\n\u003e With `yarn` :\n```bash\nyarn add @nftgo/gotrading\n```\n\n### 2. Import and init the GoTrading SDK.\nInstantiate the instance of GoTrading using your etheres provider with API key.\n```ts\nimport { init, Config } from '@nftgo/gotrading';\nimport Web3 from 'web3';\n\n// Create a new Web3 Provider to interact with the Ethereum network.\nconst provider = new Web3.providers.HttpProvider('https://mainnet.infura.io') //Replace with your own provider\n\n// Configure the necessary parameters for the Trade Aggregator API client.\nconst configs: Config = {\n  apiKey: \"YOUR-API-KEY\", // Replace with your own API Key.\n  web3Provider: provider,\n  walletConfig: {\n    address: \"Your wallet address\",\n    privateKey: \"Your private key\"\n  }, // Replace with your wallet info.\n};\n\n// Create a Trade Aggregator client instance and return the utility and aggregator objects of the Trade Aggregator API.\nconst {aggregator, utils, orderFetcher} = init(configs);\n```\n\u003e If you need to obtain an API key or a custom plan, please contact our support team. You can reach us by submitting a [form](https://forms.monday.com/forms/7fd30cd3cef08cf3b3dbccd1c72892b5), and we will respond to you within 1-2 business days.\n\u003e\n\u003e Please note that we may need to understand your use case and requirements in order to provide you with the API key and custom plan that best suits your needs. Thank you for your interest in our service, and we look forward to working with you.\n###  3. Fulfill Listings\n```ts\n\nimport { init, Config, FulfillListingsReq } from '@nftgo/gotrading';\n\nasync function demo() {\n  const config: Config = {};\n\n  const { aggregator, utils } = init(config);\n\n  const {listingDTOs} = await orderFetcher.getOrdersByContract({\n    contractAddress: '0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d', // bayc contract address\n    orderType: OrderType.Listing\n  })\n  const req: FulfillListingsReq = {\n    buyer: 'xxx', // your address\n    orderIds: listingDTOs.map(listingDTO =\u003e listingDTO.orderId),\n    safeMode: false,\n  };\n\n  // get actions, meanwhile we provide executeActions function to deal with actions\n  const { actions, executeActions } = await aggregator.fulfillListings(req);\n\n\n  // case 1\n  // RECOMMEND: use execute functions we provide\n  await executeActions({\n    onTaskExecuted(task) {\n      // do something with completed task info\n      console.log(task.action.name, task.status);\n    },\n  });\n  console.log('success');\n\n  // case 2\n  // execute actions by yourself\n  const executor = utils.createActionExecutor(actions);\n  for (const task of executor) {\n    await task.execute();\n    console.log(task.action.name, task.status);\n  }\n  console.log('success');\n}\n```\n\n## SDK Core Methods\nTo use the GoTrading SDK, you need to initialize the SDK with your API key. After initialization, you can use the following methods to interact with the GoTrading API.\n\n```ts\nimport { init, Config } from '@nftgo/gotrading';\n\nconst config: Config = {\n  apiKey: 'YOUR-API-KEY',\n  openSeaApiKeyConfig: {\n    apiKey: 'YOUR-OPENSEA-API-KEY',\n    requestsPerInterval: 10, // 10 requests per interval\n    interval: 1000, // 1 second\n  },\n  looksRareApiKeyConfig: {\n    apiKey: 'YOUR-LOOKSRARE-API-KEY',\n    requestsPerInterval: 10, // 10 requests per interval\n    interval: 1000, // 1 second\n  },\n  x2y2ApiKeyConfig: {\n    apiKey: 'YOUR-X2Y2-API-KEY',\n    requestsPerInterval: 10, // 10 requests per interval\n    interval: 1000, // 1 second\n  },\n  walletConfig: {\n    address: 'Your wallet address',\n    privateKey: 'Your private key',\n  }, // Replace with your wallet info.\n};\n\nconst goTrading = init(config);\n```\n\n### Marketplace\nThe Marketplace methods are used to create and fulfill listings and offers across all marketplaces.\n\n#### Create Listings\n```ts\nimport { CreateListingsReq, Orderbook, OrderKind } from '@nftgo/gotrading';\n\nconst req: CreateListingsReq = {\n  maker: 'xxx', // your address\n  params: [\n    {\n      token: '0x97a20815a061eae224c4fdf3109731f73743db73:2',\n      quantity: 1,\n      weiPrice: '1000',\n      orderKind: OrderKind.SeaportV15,\n      orderbook: Orderbook.Opensea,\n      listingTime: '1688625367',\n      expirationTime: '1689858225',\n      currency: '0x0000000000000000000000000000000000000000',\n      automatedRoyalties: true,\n    },\n    {\n      token: '0x97a20815a061eae224c4fdf3109731f73743db73:2',\n      quantity: 1,\n      weiPrice: '1000',\n      orderKind: OrderKind.X2Y2,\n      orderbook: Orderbook.X2Y2,\n      listingTime: '1688625367',\n      expirationTime: '1689858225',\n      currency: '0x0000000000000000000000000000000000000000',\n    },\n    {\n      token: '0x97a20815a061eae224c4fdf3109731f73743db73:2',\n      quantity: 1,\n      weiPrice: '1000',\n      orderKind: OrderKind.LooksRareV2,\n      orderbook: Orderbook.LooksRare,\n      listingTime: '1688625367',\n      expirationTime: '1689858225',\n      currency: '0x0000000000000000000000000000000000000000',\n    },\n    {\n      token: '0x61628d84d0871a38f102d5f16f4e69ee91d6cdd9:7248',\n      quantity: 1,\n      weiPrice: '1000',\n      orderKind: OrderKind.SeaportV15,\n      orderbook: Orderbook.Opensea,\n      listingTime: '1688625367',\n      expirationTime: '1689858225',\n      currency: '0x0000000000000000000000000000000000000000',\n      automatedRoyalties: true,\n    },\n  ],\n};\n\nconst response = await goTrading.aggregator.createListings(req);\n\nawait response.executeActions({\n  onTaskExecuted(task) {\n    console.log(task.action.name, task.status);\n  },\n});\n\n\n```\n#### Create Offers\n```ts\nimport { CreateOffersReq, Orderbook, OrderKind } from '@nftgo/gotrading';\n\nconst req: CreateOffersReq = {\n  maker: 'xxx', // your address\n  params: [\n    {\n      collection: '0x8d04a8c79ceb0889bdd12acdf3fa9d207ed3ff63',\n      weiPrice: '10000000000',\n      orderKind: OrderKind.SeaportV15,\n      orderbook: Orderbook.Opensea,\n      listingTime: '1689017272',\n      expirationTime: '1688017272',\n      quantity: 2,\n    },\n    {\n      collection: '0x8d04a8c79ceb0889bdd12acdf3fa9d207ed3ff63',\n      weiPrice: '10000000000',\n      orderKind: OrderKind.LooksRareV2,\n      orderbook: Orderbook.Looksrare,\n      listingTime: '1689017272',\n      expirationTime: '1688017272',\n      quantity: 1,\n    }\n  ],\n};\n\nconst response = await goTrading.aggregator.createOffers(req);\n\nawait response.executeActions({\n  onTaskExecuted(task) {\n    console.log(task.action.name, task.status);\n  },\n});\n\n```\n\n#### Fulfill Listings\n```ts\nimport { FulfillListingsReq, Orderbook, OrderKind } from '@nftgo/gotrading';\n\nconst orderIds = ['xxx', 'yyy']; // pass the listing ids you want to fulfill\n\nconst req: FulfillListingsReq = {\n  buyer: 'xxx', // your address\n  orderIds,\n};\n\nconst response = await goTrading.aggregator.fulfillListings(req);\n\nawait response.executeActions({\n  onTaskExecuted(task) {\n    console.log(task.action.name, task.status);\n  },\n});\n\n```\n\n#### Fulfill Offers\n```ts\nimport { FulfillOffersReq, Orderbook, OrderKind } from '@nftgo/gotrading';\n\nconst orderIds = ['xxx', 'yyy']; // pass the offer ids you want to fulfill\n\nconst req: FulfillOffersReq = {\n  sellerAddress: 'xxx', // your address\n  offerFulfillmentIntentions: [\n    {\n      orderId: orderIds[0],\n      contractAddress: \"0x02d66f9d220553d831b239f00b5841280ddcfaf3\",\n      tokenId: \"1\",\n      quantity: 1,\n    },\n    {\n      orderId: orderIds[1],\n      contractAddress: \"0x02d66f9d220553d831b239f00b5841280ddcfaf3\",\n      tokenId: \"2\",\n      quantity: 1,\n    },\n  ],\n};\n\nconst response = await goTrading.aggregator.fulfillOffers(req);\n\nawait response.executeActions({\n  onTaskExecuted(task) {\n    console.log(task.action.name, task.status);\n  },\n});\n\n```\n\n#### Cancel Orders\n```ts\nimport { CancelOrdersReq, Orderbook, OrderKind } from '@nftgo/gotrading';\n\n\nconst cancelOrdersReq: CancelOrdersReq = {\n  callerAddress: 'xxx', // your address\n  orders: [\n    {\n      orderId: 'aaa',\n      orderType: OrderType.Listing,\n    },\n    {\n      orderId: 'bbb',\n      orderType: OrderType.Offer,\n    },\n  ],\n};\n\nconst response = await goTrading.aggregator.cancelOrders(cancelOrdersReq);\n\nawait response.executeActions({\n  onTaskExecuted(task) {\n    console.log(task.action.name, task.status);\n  },\n});\n\n```\n\n### OrderFetcher\n\n#### Get Orders By Contract\n```ts\nimport { OrderType, GetOrdersByContractReq } from '@nftgo/gotrading';\n\n// Get listings by contractAddress\nconst getOrdersByContractReq: GetOrdersByContractReq = {\n  contractAddress: '0x97a20815a061eae224c4fdf3109731f73743db73',\n  orderType: OrderType.Listing,\n};\n\nconst { listingDTOs } = await goTrading.orderFetcher.getOrdersByContract(getOrdersByContractReq);\n\n// Get offers by contractAddress\nconst getOffersByContractReq: GetOrdersByContractReq = {\n  contractAddress: '0x97a20815a061eae224c4fdf3109731f73743db73',\n  orderType: OrderType.Offer,\n};\n\nconst { offerDTOs } = await goTrading.orderFetcher.getOrdersByContract(getOrdersByContractReq);\n\n\n```\n\n#### Get Orders By NFT\n```ts\nimport { OrderType, GetOrdersByNftsReq } from '@nftgo/gotrading';\n\n// Get listings by nft\nconst getOrdersByNftsReq: GetOrdersByNftsReq = {\n  contractAddress: '0x8d04a8c79ceb0889bdd12acdf3fa9d207ed3ff63',\n  tokenId: '1',\n  orderType: OrderType.Listing,\n};\n\nconst { listingDTOs } = await goTrading.orderFetcher.getOrdersByNFT(getOrdersByNftsReq);\n\n// Get offers by nft\nconst getOffersByNftsReq: GetOrdersByNftsReq = {\n  contractAddress: '0x8d04a8c79ceb0889bdd12acdf3fa9d207ed3ff63',\n  tokenId: '1',\n  orderType: OrderType.Offer,\n};\n\nconst { offerDTOs } = await goTrading.orderFetcher.getOrdersByNFT(getOffersByNftsReq);\n\n```\n\n#### Get Orders By Ids\n```ts\nimport { OrderType, GetOrdersByIdsReq } from '@nftgo/gotrading';\n\nconst getOrdersByIdsReq: GetOrdersByIdsReq = {\n  orders: [\n    {\n      orderId: 'xxx',\n      orderType: OrderType.Listing,\n    },\n    {\n      orderId: 'yyy',\n      orderType: OrderType.Offer,\n    },\n  ],\n};\n\nconst { listingDTOs, offerDTOs } = await goTrading.orderFetcher.getOrdersByIds(getOrdersByIdsReq);\n\n```\n\n#### Get Orders By Maker\n```ts\nimport { OrderType, GetOrdersByMakerReq } from '@nftgo/gotrading';\n\n// Get listings by maker\nconst getOrdersByMakerReq: GetOrdersByMakerReq = {\n  maker: 'xxx', // your address\n  orderType: OrderType.Listing,\n};\n\nconst { listingDTOs } = await goTrading.orderFetcher.getOrdersByMaker(getOrdersByMakerReq);\n\n// Get offers by maker\nconst getOffersByMakerReq: GetOrdersByMakerReq = {\n  maker: 'xxx', // your address\n  orderType: OrderType.Offer,\n};\n\nconst { offerDTOs } = await goTrading.orderFetcher.getOrdersByMaker(getOffersByMakerReq);\n\n```\n\n### Utils\n\n## Questions \u0026 Feedback\n\n\u003e If you have any questions, issues, or feedback, please file an issue on GitHub, or drop us a message on our [Discord][discord-url] channel for the SDK.\n\n##  License\n\nThis project is licensed under the [BSD-3-Clause license](LICENSE).\n\n\n[discord-image]: https://img.shields.io/discord/1040195071401787413?color=brightgreen\u0026label=Discord\u0026logo=discord\u0026logoColor=blue\n[discord-url]:  https://discord.gg/nftgo\n[twitter-image]: https://img.shields.io/twitter/follow/NFTGo?label=NFTGo\u0026style=social\n[twitter-url]:  https://twitter.com/NFTGoDevs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnftgo%2Fgotrading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnftgo%2Fgotrading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnftgo%2Fgotrading/lists"}