Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gchatz22's full-sized avatar

giannis gchatz22

View GitHub Profile
import { connectionFor, executeTransaction } from "@cardinal/common";
import { utils, Wallet } from "@coral-xyz/anchor";
import type { Cluster } from "@solana/web3.js";
import { Keypair, SystemProgram, Transaction } from "@solana/web3.js";
import dotenv from "dotenv";
import {
findStakePoolId,
rewardsCenterProgram,
SOL_PAYMENT_INFO,
import { executeTransaction } from "@cardinal/common";
import type { Wallet } from "@coral-xyz/anchor";
import { BN } from "@coral-xyz/anchor";
import type { Connection } from "@solana/web3.js";
import { PublicKey, Transaction } from "@solana/web3.js";
import { findPaymentInfoId, rewardsCenterProgram } from "../../sdk";
export const commandName = "createPaymentInfo";
export const description = "Create a payment info object";
import type { CardinalProvider } from "@cardinal/common";
import {
executeTransaction,
executeTransactions,
getTestProvider,
} from "@cardinal/common";
import { beforeAll, expect, test } from "@jest/globals";
import type { PublicKey } from "@solana/web3.js";
import { Keypair, SystemProgram, Transaction } from "@solana/web3.js";
import { BN } from "bn.js";
import type { CardinalProvider } from "@cardinal/common";
import {
executeTransaction,
executeTransactions,
getTestProvider,
tryGetAccount,
} from "@cardinal/common";
import { beforeAll, expect, test } from "@jest/globals";
import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token";
import type { PublicKey } from "@solana/web3.js";
@gchatz22
gchatz22 / gist:6b80629481a7c14988d1ee3e98fd7aa6
Created September 26, 2022 15:45
Wrap Token (issue + claim token manager for mint in same transaction)
export const withWrapToken = async (
transaction: Transaction,
connection: Connection,
wallet: Wallet,
mintId: PublicKey,
listingAuthorityName?: string,
payer = wallet.publicKey
): Promise<[Transaction, PublicKey]> => {
const [tokenManagerId] = await findTokenManagerAddress(mintId);
const checkTokenManager = await tryGetAccount(() =>