Skip to content

Instantly share code, notes, and snippets.

@FernandoEscher
Created June 24, 2022 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FernandoEscher/c0d5aa0f9b6c0f70fa38d19ec1e1a603 to your computer and use it in GitHub Desktop.
Save FernandoEscher/c0d5aa0f9b6c0f70fa38d19ec1e1a603 to your computer and use it in GitHub Desktop.
Sample code reading collections from rarible
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