Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .api/api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "1.0",
"apis": [
{
"identifier": "rarible",
"source": "@rarible/v1.1#5ep6k2rm5qwbqgq",
"integrity": "sha512-Eyt1LMAIe9XJvbzkfUoPbPoW03sIuASnxY/sR60Ep4nVDOPZfg2k4dk4w54S4h0/R7U7dBiJIGGOCqbJ9mkNog==",
"installerVersion": "6.1.2"
}
]
}
951 changes: 951 additions & 0 deletions .api/apis/rarible/index.ts

Large diffs are not rendered by default.

856,609 changes: 856,609 additions & 0 deletions .api/apis/rarible/openapi.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .api/apis/rarible/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@api/rarible",
"version": "0.1.0",
"main": "./index.ts",
"types": "./index.d.ts",
"dependencies": {
"api": "^6.1.2",
"json-schema-to-ts": "^2.8.0-beta.0",
"oas": "^20.10.3"
}
}
151 changes: 151 additions & 0 deletions .api/apis/rarible/schemas.ts

Large diffs are not rendered by default.

320 changes: 320 additions & 0 deletions .api/apis/rarible/types.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@api/rarible": "file:.api/apis/rarible",
"@coral-xyz/anchor": "0.29.0",
"@invariant-labs/sdk-eclipse": "^0.0.68",
"@onsol/tldparser": "^0.6.7",
Expand Down
18 changes: 18 additions & 0 deletions scripts/check-nft.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import rarible from "@api/rarible";
require("dotenv").config();

const ADDRESS = "3AE1okHV9UMweZ7h1dMNEsR9HVAURHxxN9N8c4vUZUxgHw";
const COLLECTION = "ECLIPSE:Ce4vXCcx8pRihFeyUfxbVYb93KiBpnKxZ94WioXc8SbX";

const main = async () => {
rarible.auth(process.env.RARIBLE_API_KEY as string);
const { data } = await rarible.getItemsByOwner({
blockchains: ["ECLIPSE"],
owner: `SOLANA%${ADDRESS}`,
});

const hasNFT = data.items.some((nft) => nft.collection === COLLECTION);
console.log(hasNFT);
};

main();
42 changes: 42 additions & 0 deletions scripts/get-nft-owner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { AnchorProvider } from "@coral-xyz/anchor";
import { getAccount, TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";

require("dotenv").config();

const provider = AnchorProvider.local("https://eclipse.helius-rpc.com");

const connection = provider.connection;
const PROGRAM_ID = TOKEN_2022_PROGRAM_ID;
const NFT_ADDRESS = new PublicKey(
"JA5ZrG74FErSv8rHNUsirKysB26mboET6bGa43sPG4Ut"
);
const EXPECTED_OWNER = new PublicKey(
"CnJtnBkDdsuaRTQR22gQwYbU1zmBMFrLeety4EL9BUN6"
);
const main = async () => {
const [tokenAccount] = await connection.getProgramAccounts(PROGRAM_ID, {
filters: [
{
dataSize: 170,
},
{
memcmp: {
offset: 0,
bytes: NFT_ADDRESS.toString(),
},
},
],
});

const accInfo = await getAccount(
connection,
tokenAccount.pubkey,
undefined,
PROGRAM_ID
);

console.log("Expected Owner:", EXPECTED_OWNER.toString());
console.log("Received Owner:", accInfo.owner.toString());
};
main();