Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci build from xnft import #3512

Merged
merged 1 commit into from
Mar 30, 2023
Merged
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
24 changes: 19 additions & 5 deletions packages/recoil/src/atoms/solana/xnft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ import {
XNFT_GG_LINK,
XNFT_PROGRAM_ID,
} from "@coral-xyz/common";
import { type IdlXnftAccount, xNFT } from "@coral-xyz/xnft";
import { PublicKey } from "@solana/web3.js";
import { buildAnonymousProgram } from "@coral-xyz/xnft/lib/util";
import { IDL, type Xnft } from "@coral-xyz/xnft/lib/xnft";
import {
AnchorProvider,
type IdlAccounts,
Program,
Wallet,
} from "@project-serum/anchor";
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
import * as cheerio from "cheerio";
import { atomFamily, selectorFamily } from "recoil";

Expand All @@ -22,6 +29,13 @@ import { anchorContext } from "./wallet";

export const SIMULATOR_URL = `http://localhost:${SIMULATOR_PORT}`;

// const xnftProgram = (conn: Connection): Program<Xnft> =>
// new Program(
// IDL,
// XNFT_PROGRAM_ID,
// new AnchorProvider(conn, new Wallet(Keypair.generate()), {})
// );

export const appStoreMetaTags = selectorFamily<
{ name?: string; description?: string; image?: string },
string
Expand Down Expand Up @@ -57,7 +71,7 @@ export const collectibleXnft = selectorFamily<
}

const { connection } = get(anchorContext);
const client = xNFT.anonymous(connection);
const program = buildAnonymousProgram(connection);

if (params.collection) {
const [maybeCollectionXnft] = await PublicKey.findProgramAddress(
Expand All @@ -67,7 +81,7 @@ export const collectibleXnft = selectorFamily<

const acc = await connection.getAccountInfo(maybeCollectionXnft);
if (acc) {
const data = client.program.coder.accounts.decode<IdlXnftAccount>(
const data = program.coder.accounts.decode<IdlAccounts<Xnft>["xnft"]>(
"xnft",
acc.data
);
Expand All @@ -86,7 +100,7 @@ export const collectibleXnft = selectorFamily<
const acc = await connection.getAccountInfo(maybeItemXnft);

if (acc) {
const data = client.program.coder.accounts.decode<IdlXnftAccount>(
const data = program.coder.accounts.decode<IdlAccounts<Xnft>["xnft"]>(
"xnft",
acc.data
);
Expand Down