Created
June 24, 2022 17:20
-
-
Save FernandoEscher/c0d5aa0f9b6c0f70fa38d19ec1e1a603 to your computer and use it in GitHub Desktop.
Sample code reading collections from rarible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FormData from "form-data" | |
import fetch from "node-fetch"; | |
import { TezosWallet } from "@rarible/sdk-wallet" | |
// eslint-disable-next-line camelcase | |
import { in_memory_provider } from "@rarible/tezos-sdk/dist/providers/in_memory/in_memory_provider" | |
import { Blockchain } from "@rarible/api-client" | |
import { createRaribleSdk } from "@rarible/sdk/build" | |
// Dependencies. | |
(global as any).FormData = FormData; | |
(global as any).window = { | |
fetch: fetch, | |
dispatchEvent: () => {}, | |
}; | |
(global as any).CustomEvent = function CustomEvent() { | |
return | |
} | |
// Initialize SDK in staging environment. | |
const raribleSDK = createRaribleSdk(undefined, "staging") | |
// raribleSDK.apis.collection.getAllCollections({blockchains: [Blockchain.TEZOS], size: 10}).then( (collections) => | |
// console.log(collections) | |
// ) | |
raribleSDK.apis.item.getItemsByCollection({collection: "TEZOS:KT18far4C9Hvs7uHi2KzzRZF8f9EX5dhcVQP"}).then( (items) => | |
console.log(items) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment