diff --git a/.github/actions/install-linux-build-deps/action.yml b/.github/actions/install-linux-build-deps/action.yml index 18723ee8..4644a09e 100644 --- a/.github/actions/install-linux-build-deps/action.yml +++ b/.github/actions/install-linux-build-deps/action.yml @@ -9,12 +9,6 @@ runs: sudo apt-get update shell: bash - - name: apt-get install clang - run: | - sudo apt-get install -y clang-7 --allow-unauthenticated - clang-7 --version - shell: bash - - name: apt-get install ssl libs run: | sudo apt-get install -y openssl --allow-unauthenticated diff --git a/Makefile b/Makefile index 04cad170..17060f24 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ install: yarn install build: - anchor build && cargo +nightly fmt - yarn idl:generate && yarn sdk:generate && yarn lint && yarn build + anchor build + yarn idl:generate && yarn lint && yarn build start: solana-test-validator --url https://api.mainnet-beta.solana.com \ diff --git a/generate-sdk.js b/generate-sdk.js deleted file mode 100644 index 85dccaa3..00000000 --- a/generate-sdk.js +++ /dev/null @@ -1,33 +0,0 @@ -const { Solita } = require("@metaplex-foundation/solita"); -const { writeFile } = require("fs/promises"); -const path = require("path"); - -const idlDir = path.join(__dirname, "sdk/idl"); -const configs = [ - { - programName: "cardinal_rewards_center", - programId: "rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U", - programDir: "programs/cardinal-rewards-center", - outDir: path.join(__dirname, "sdk", "generated"), - }, -]; - -async function main() { - for (let i = 0; i < configs.length; i++) { - const config = configs[i]; - console.error(`\n[${config.programName}] => ${config.outDir}`); - const idlPath = path.join(idlDir, `${config.programName}_idl.json`); - const idl = require(idlPath); - if (idl.metadata?.address == null) { - idl.metadata = { ...idl.metadata, address: config.programId }; - await writeFile(idlPath, JSON.stringify(idl, null, 2)); - } - const gen = new Solita(idl, { formatCode: true }); - await gen.renderAndWriteTo(config.outDir); - } -} - -main().catch((err) => { - console.error(err); - process.exit(1); -}); diff --git a/package.json b/package.json index 9c825af5..b0dcba89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cardinal/rewards-center", - "version": "0.2.8", + "version": "2.1.0-beta.4", "description": "Cardinal rewards center", "keywords": [ "solana", @@ -29,7 +29,6 @@ "build": "rm -fr dist/ && tsc -P tsconfig.cjs.json && tsc -P tsconfig.esm.json", "clean": "rm -fr dist/", "idl:generate": "./generate-idls.sh", - "sdk:generate": "node generate-sdk.js", "erd:generate": "node generate-erd.js", "docs:generate": "typedoc --excludePrivate --includeVersion --out site/ sdk/index.ts", "typecheck": "tsc", @@ -39,10 +38,10 @@ "dependencies": { "@cardinal/common": "^4.0.1", "@metaplex-foundation/rustbin": "^0.3.1", - "@metaplex-foundation/solita": "^0.12.2", "@project-serum/anchor": "0.25.0", "@solana/web3.js": "^1.66.2", - "bn.js": "^5.2.0" + "bn.js": "^5.2.0", + "js-sha256": "^0.9.0" }, "resolutions": { "@solana/spl-token": "=0.3.6" @@ -65,7 +64,6 @@ "eslint-plugin-unused-imports": "^2.0.0", "jest": "^29.2.1", "lint-staged": "^13.0.3", - "mpl-token-metadata-v1": "npm:@metaplex-foundation/mpl-token-metadata@1.2.5", "pretty-quick": "^3.1.3", "readline": "^1.3.0", "ts-jest": "^29.0.3", diff --git a/sdk/accounts.ts b/sdk/accounts.ts index 9c24dcbf..67b31b81 100644 --- a/sdk/accounts.ts +++ b/sdk/accounts.ts @@ -1,182 +1,307 @@ import { getBatchedMultipleAccounts } from "@cardinal/common"; -import type { AccountInfo, Connection, PublicKey } from "@solana/web3.js"; - -import { - PROGRAM_ID, - ReceiptManager, - receiptManagerDiscriminator, - RewardDistributor, - rewardDistributorDiscriminator, - RewardEntry, - rewardEntryDiscriminator, - RewardReceipt, - rewardReceiptDiscriminator, - StakeAuthorizationRecord, - stakeAuthorizationRecordDiscriminator, - StakeBooster, - stakeBoosterDiscriminator, - StakeEntry, - stakeEntryDiscriminator, - StakePool, - stakePoolDiscriminator, -} from "./generated"; - -export type AccountData = AccountInfo & { pubkey: PublicKey } & ( +import type { Idl } from "@project-serum/anchor"; +import { BorshAccountsCoder, utils } from "@project-serum/anchor"; +import type { + AllAccountsMap, + IdlTypes, + TypeDef, +} from "@project-serum/anchor/dist/cjs/program/namespace/types"; +import type { + AccountInfo, + Connection, + GetAccountInfoConfig, + GetProgramAccountsConfig, + PublicKey, +} from "@solana/web3.js"; + +import { REWARDS_CENTER_ADDRESS, REWARDS_CENTER_IDL } from "./constants"; +import type { CardinalRewardsCenter } from "./idl/cardinal_rewards_center"; + +export type ParsedIdlAccount = { + [T in keyof AllAccountsMap]: { + type: T; + parsed: TypeDef[T], IdlTypes>; + }; +}; + +export type IdlAccountInfo< + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +> = AccountInfo & + ( + | ParsedIdlAccount[T] | { - type: "rewardDistributor"; - parsed: RewardDistributor; + type: "unknown"; + parsed: null; } - | { type: "rewardEntry"; parsed: RewardEntry } - | { type: "stakePool"; parsed: StakePool } - | { type: "stakeEntry"; parsed: StakeEntry } - | { type: "receiptManager"; parsed: ReceiptManager } - | { type: "rewardReceipt"; parsed: RewardReceipt } - | { type: "stakeBooster"; parsed: StakeBooster } - | { type: "stakeAuthorizationRecord"; parsed: StakeAuthorizationRecord } - | { type: "unknown"; parsed: null } ); -export type AccountDataById = { - [accountId: string]: AccountData; +export type IdlAccountData< + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +> = { + pubkey: PublicKey; + timestamp: number; +} & IdlAccountInfo; + +/** + * Fetch an account with idl types + * @param connection + * @param pubkey + * @param accountType + * @param config + * @returns + */ +export const fetchIdlAccount = async < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + connection: Connection, + pubkey: PublicKey, + accountType: T, + config?: GetAccountInfoConfig +) => { + const account = await fetchIdlAccountNullable( + connection, + pubkey, + accountType, + config + ); + if (!account) throw "Account info not found"; + return account; +}; + +/** + * Fetch a possibly null account with idl types of a specific type + * @param connection + * @param pubkey + * @param accountType + * @param config + * @param idl + * @returns + */ +export const fetchIdlAccountNullable = async < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + connection: Connection, + pubkey: PublicKey, + accountType: T, + config?: GetAccountInfoConfig, + idl: Idl = REWARDS_CENTER_IDL +) => { + const accountInfo = await connection.getAccountInfo(pubkey, config); + if ( + !accountInfo || + accountInfo.owner.toString() !== REWARDS_CENTER_ADDRESS.toString() + ) + return null; + + const parsed: TypeDef< + AllAccountsMap[T], + IdlTypes + > = new BorshAccountsCoder(idl).decode(accountType, accountInfo.data); + return { + ...accountInfo, + pubkey, + parsed, + type: accountType, + }; +}; + +/** + * Decode an account with idl types of a specific type + * @param accountInfo + * @param accountType + * @param idl + * @returns + */ +export const decodeIdlAccount = < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + accountInfo: AccountInfo, + accountType: T, + idl: Idl = REWARDS_CENTER_IDL +) => { + const parsed: TypeDef< + AllAccountsMap[T], + IdlTypes + > = new BorshAccountsCoder(idl).decode(accountType, accountInfo.data); + return { + ...accountInfo, + type: accountType, + parsed, + }; +}; + +/** + * Try to decode an account with idl types of specific type + * @param accountInfo + * @param accountType + * @param idl + * @returns + */ +export const tryDecodeIdlAccount = < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + accountInfo: AccountInfo, + accountType: T, + idl: Idl = REWARDS_CENTER_IDL +) => { + try { + return decodeIdlAccount(accountInfo, accountType, idl); + } catch (e) { + return { + ...accountInfo, + type: "unknown", + parsed: null, + }; + } }; -export const deserializeAccountInfos = ( - accountIds: (PublicKey | null)[], +/** + * Decode an idl account of unknown type + * @param accountInfo + * @param idl + * @returns + */ +export const decodeIdlAccountUnknown = < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + accountInfo: AccountInfo | null, + idl: Idl = REWARDS_CENTER_IDL +): AccountInfo & ParsedIdlAccount[T] => { + if (!accountInfo) throw "No account found"; + // get idl accounts + const idlAccounts = idl["accounts"]; + if (!idlAccounts) throw "No account definitions found in IDL"; + // find matching account name + const accountTypes = idlAccounts.map((a) => a.name); + const accountType = accountTypes?.find( + (accountType) => + BorshAccountsCoder.accountDiscriminator(accountType).compare( + accountInfo.data.subarray(0, 8) + ) === 0 + ); + if (!accountType) throw "No account discriminator match found"; + + // decode + const parsed: TypeDef< + AllAccountsMap[T], + IdlTypes + > = new BorshAccountsCoder(idl).decode(accountType, accountInfo.data); + return { + ...accountInfo, + type: accountType as T, + parsed, + }; +}; + +/** + * Try to decode an account with idl types of unknown type + * @param accountInfo + * @param idl + * @returns + */ +export const tryDecodeIdlAccountUnknown = < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + accountInfo: AccountInfo, + idl: Idl = REWARDS_CENTER_IDL +): IdlAccountInfo => { + try { + return decodeIdlAccountUnknown(accountInfo, idl); + } catch (e) { + return { + ...accountInfo, + type: "unknown", + parsed: null, + }; + } +}; + +/** + * Get program accounts of a specific idl type + * @param connection + * @param accountType + * @param config + * @param programId + * @param idl + * @returns + */ +export const getProgramIdlAccounts = async < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + connection: Connection, + accountType: T, + config?: GetProgramAccountsConfig, + programId: PublicKey = REWARDS_CENTER_ADDRESS, + idl: Idl = REWARDS_CENTER_IDL +) => { + const accountInfos = await connection.getProgramAccounts(programId, { + filters: [ + { + memcmp: { + offset: 0, + bytes: utils.bytes.bs58.encode( + BorshAccountsCoder.accountDiscriminator(accountType) + ), + }, + }, + ...(config?.filters ?? []), + ], + }); + return accountInfos.map((accountInfo) => ({ + pubkey: accountInfo.pubkey, + ...tryDecodeIdlAccount(accountInfo.account, accountType, idl), + })); +}; + +export type IdlAccountDataById< + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +> = { + [accountId: string]: IdlAccountData; +}; + +/** + * Decode account infos with corresponding ids + * @param accountIds + * @param accountInfos + * @returns + */ +export const decodeAccountInfos = < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( + accountIds: PublicKey[], accountInfos: (AccountInfo | null)[] -): AccountDataById => { +): IdlAccountDataById => { return accountInfos.reduce((acc, accountInfo, i) => { if (!accountInfo?.data) return acc; + const accoutIdString = accountIds[i]?.toString() ?? ""; const ownerString = accountInfo.owner.toString(); const baseData = { timestamp: Date.now(), pubkey: accountIds[i]!, }; - const discriminator = accountInfo.data - .subarray(0, 8) - .map((b) => b.valueOf()) - .join(","); - switch ([ownerString, discriminator].join(":")) { + switch (ownerString) { // stakePool - case [PROGRAM_ID.toString(), stakePoolDiscriminator.join(",")].join(":"): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "stakePool", - parsed: StakePool.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // rewardDistributor - case [ - PROGRAM_ID.toString(), - rewardDistributorDiscriminator.join(","), - ].join(":"): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "rewardDistributor", - parsed: RewardDistributor.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // stakeEntry - case [PROGRAM_ID.toString(), stakeEntryDiscriminator.join(",")].join(":"): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "stakeEntry", - parsed: StakeEntry.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // rewardEntry - case [PROGRAM_ID.toString(), rewardEntryDiscriminator.join(",")].join( - ":" - ): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "rewardEntry", - parsed: RewardEntry.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // receiptManager - case [PROGRAM_ID.toString(), receiptManagerDiscriminator.join(",")].join( - ":" - ): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "receiptManager", - parsed: ReceiptManager.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // rewardReceipt - case [PROGRAM_ID.toString(), rewardReceiptDiscriminator.join(",")].join( - ":" - ): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "rewardReceipt", - parsed: RewardReceipt.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // stakeBooster - case [PROGRAM_ID.toString(), stakeBoosterDiscriminator.join(",")].join( - ":" - ): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "stakeBooster", - parsed: StakeBooster.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } - return acc; - // stakeAuthorizationRecord - case [ - PROGRAM_ID.toString(), - stakeAuthorizationRecordDiscriminator.join(","), - ].join(":"): - try { - acc[accountIds[i]!.toString()] = { - ...baseData, - ...accountInfo, - type: "stakeAuthorizationRecord", - parsed: StakeAuthorizationRecord.deserialize(accountInfo.data)[0], - }; - } catch (e) { - // - } + case REWARDS_CENTER_ADDRESS.toString(): { + acc[accoutIdString] = { + ...baseData, + ...tryDecodeIdlAccountUnknown(accountInfo), + }; return acc; + } // fallback default: - acc[accountIds[i]!.toString()] = { + acc[accoutIdString] = { ...baseData, ...accountInfo, type: "unknown", @@ -184,17 +309,26 @@ export const deserializeAccountInfos = ( }; return acc; } - }, {} as AccountDataById); + }, {} as IdlAccountDataById); }; -export const fetchAccountDataById = async ( +/** + * Batch fetch a map of accounts and their corresponding ids + * @param connection + * @param ids + * @returns + */ +export const fetchIdlAccountDataById = async < + T extends keyof AllAccountsMap, + IDL extends Idl = CardinalRewardsCenter +>( connection: Connection, ids: (PublicKey | null)[] -): Promise => { +): Promise> => { const filteredIds = ids.filter((id): id is PublicKey => id !== null); const accountInfos = await getBatchedMultipleAccounts( connection, filteredIds ); - return deserializeAccountInfos(filteredIds, accountInfos); + return decodeAccountInfos(filteredIds, accountInfos); }; diff --git a/sdk/api.ts b/sdk/api.ts index 797a9463..69f456eb 100644 --- a/sdk/api.ts +++ b/sdk/api.ts @@ -1,27 +1,18 @@ import { withFindOrInitAssociatedTokenAccount } from "@cardinal/common"; import type * as beet from "@metaplex-foundation/beet"; -import * as tokenMetadata from "@metaplex-foundation/mpl-token-metadata"; import type { Wallet } from "@project-serum/anchor/dist/cjs/provider"; -import { getAssociatedTokenAddressSync } from "@solana/spl-token"; +import { + getAssociatedTokenAddressSync, + TOKEN_PROGRAM_ID, +} from "@solana/spl-token"; import type { Connection, PublicKey } from "@solana/web3.js"; -import { Transaction } from "@solana/web3.js"; +import { SystemProgram, Transaction } from "@solana/web3.js"; import { BN } from "bn.js"; -import * as tokenMetadatV1 from "mpl-token-metadata-v1"; -import { fetchAccountDataById } from "./accounts"; -import { - createBoostStakeEntryInstruction, - createClaimRewardReceiptInstruction, - createClaimRewardsInstruction, - createInitEntryInstruction, - createInitRewardEntryInstruction, - createInitRewardReceiptInstruction, - createStakeEditionInstruction, - createUnstakeEditionInstruction, - createUpdateTotalStakeSecondsInstruction, -} from "./generated"; +import { fetchIdlAccountDataById } from "./accounts"; +import type { PaymentShare } from "./constants"; +import { rewardsCenterProgram } from "./constants"; import { - withRemainingAccounts, withRemainingAccountsForPayment, withRemainingAccountsForPaymentInfo, } from "./payment"; @@ -33,6 +24,11 @@ import { findStakePoolId, findUserEscrowId, } from "./pda"; +import { + findMintEditionId, + findMintMetadataId, + METADATA_PROGRAM_ID, +} from "./utils"; /** * Stake all mints and also initialize entries if not already initialized @@ -66,8 +62,7 @@ export const stake = async ( amount, }; }); - - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ stakePoolId, ...mints.map((m) => m.stakeEntryId), ]); @@ -79,22 +74,20 @@ export const stake = async ( const txs: Transaction[] = []; for (const { mintId, stakeEntryId, amount } of mints) { const tx = new Transaction(); - const metadataId = await tokenMetadatV1.Metadata.getPDA(mintId); + const metadataId = findMintMetadataId(mintId); if (!accountDataById[stakeEntryId.toString()]) { - tx.add( - createInitEntryInstruction( - { - stakeEntry: stakeEntryId, - stakePool: stakePoolId, - stakeMint: mintId, - stakeMintMetadata: metadataId, - payer: wallet.publicKey, - }, - { - user: wallet.publicKey, - } - ) - ); + const ix = await rewardsCenterProgram(connection, wallet) + .methods.initEntry(wallet.publicKey) + .accounts({ + stakeEntry: stakeEntryId, + stakePool: stakePoolId, + stakeMint: mintId, + stakeMintMetadata: metadataId, + payer: wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); } const userEscrowId = findUserEscrowId(wallet.publicKey); @@ -103,26 +96,23 @@ export const stake = async ( wallet.publicKey, true ); - const editionId = await tokenMetadatV1.Edition.getPDA(mintId); - const stakeIx = createStakeEditionInstruction( - { - stakeEntry: stakeEntryId, + const editionId = findMintEditionId(mintId); + const stakeIx = await rewardsCenterProgram(connection, wallet) + .methods.stakeEdition(new BN(amount ?? 1)) + .accounts({ stakePool: stakePoolId, + stakeEntry: stakeEntryId, stakeMint: mintId, stakeMintEdition: editionId, stakeMintMetadata: metadataId, user: wallet.publicKey, userEscrow: userEscrowId, userStakeMintTokenAccount: userAtaId, - tokenMetadataProgram: tokenMetadata.PROGRAM_ID, - }, - { - amount: amount ?? 1, - } - ); - tx.add( - withRemainingAccounts( - stakeIx, + tokenMetadataProgram: METADATA_PROGRAM_ID, + tokenProgram: TOKEN_PROGRAM_ID, + systemProgram: SystemProgram.programId, + }) + .remainingAccounts( await withRemainingAccountsForPaymentInfo( connection, tx, @@ -130,7 +120,8 @@ export const stake = async ( stakePoolData.parsed.stakePaymentInfo ) ) - ); + .instruction(); + tx.add(stakeIx); txs.push(tx); } return txs; @@ -172,7 +163,7 @@ export const unstake = async ( }; }); - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ stakePoolId, ...(rewardDistributorIds ?? []), ...mints.map((m) => m.rewardEntryIds ?? []).flat(), @@ -184,19 +175,21 @@ export const unstake = async ( const tx = new Transaction(); const userEscrowId = findUserEscrowId(wallet.publicKey); const userAtaId = getAssociatedTokenAddressSync(mintId, wallet.publicKey); - const editionId = await tokenMetadatV1.Edition.getPDA(mintId); + const editionId = findMintEditionId(mintId); if ( rewardEntryIds && rewardDistributorIds && rewardDistributorIds?.length > 0 ) { - tx.add( - createUpdateTotalStakeSecondsInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.updateTotalStakeSeconds() + .accounts({ stakeEntry: stakeEntryId, updater: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); for (let j = 0; j < rewardDistributorIds.length; j++) { const rewardDistributorId = rewardDistributorIds[j]!; const rewardDistributorData = @@ -223,8 +216,9 @@ export const unstake = async ( wallet.publicKey ); if (!rewardEntry) { - tx.add( - createInitRewardEntryInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.initRewardEntry() + .accounts({ rewardEntry: findRewardEntryId( rewardDistributorId, stakeEntryId @@ -233,7 +227,8 @@ export const unstake = async ( stakeEntry: stakeEntryId, payer: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); } const remainingAccountsForPayment = await withRemainingAccountsForPaymentInfo( @@ -242,38 +237,25 @@ export const unstake = async ( wallet.publicKey, rewardDistributorData.parsed.claimRewardsPaymentInfo ); - tx.add( - withRemainingAccounts( - createClaimRewardsInstruction({ - rewardEntry: findRewardEntryId( - rewardDistributorId, - stakeEntryId - ), - rewardDistributor: rewardDistributorId, - stakeEntry: stakeEntryId, - stakePool: stakePoolId, - rewardMint: rewardMint, - userRewardMintTokenAccount: userRewardMintTokenAccount, - rewardDistributorTokenAccount: rewardDistributorTokenAccount, - user: wallet.publicKey, - }), - remainingAccountsForPayment - ) - ); + const ix = await rewardsCenterProgram(connection, wallet) + .methods.claimRewards() + .accounts({ + rewardEntry: findRewardEntryId(rewardDistributorId, stakeEntryId), + rewardDistributor: rewardDistributorId, + stakeEntry: stakeEntryId, + stakePool: stakePoolId, + rewardMint: rewardMint, + userRewardMintTokenAccount: userRewardMintTokenAccount, + rewardDistributorTokenAccount: rewardDistributorTokenAccount, + user: wallet.publicKey, + }) + .remainingAccounts(remainingAccountsForPayment) + .instruction(); + tx.add(ix); } } } - const unstakeIx = createUnstakeEditionInstruction({ - stakeEntry: stakeEntryId, - stakePool: stakePoolId, - stakeMint: mintId, - stakeMintEdition: editionId, - user: wallet.publicKey, - userEscrow: userEscrowId, - userStakeMintTokenAccount: userAtaId, - tokenMetadataProgram: tokenMetadata.PROGRAM_ID, - }); const remainingAccounts = []; if ( stakePoolData?.type === "stakePool" && @@ -288,7 +270,21 @@ export const unstake = async ( ); remainingAccounts.push(...remainingAccountsForPayment); } - tx.add(withRemainingAccounts(unstakeIx, remainingAccounts)); + const ix = await rewardsCenterProgram(connection, wallet) + .methods.unstakeEdition() + .accounts({ + stakeEntry: stakeEntryId, + stakePool: stakePoolId, + stakeMint: mintId, + stakeMintEdition: editionId, + user: wallet.publicKey, + userEscrow: userEscrowId, + userStakeMintTokenAccount: userAtaId, + tokenMetadataProgram: METADATA_PROGRAM_ID, + }) + .remainingAccounts(remainingAccounts) + .instruction(); + tx.add(ix); txs.push(tx); } return txs; @@ -330,7 +326,7 @@ export const claimRewards = async ( }; }); - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ ...(rewardDistributorIds ?? []), ...mints.map((m) => m.rewardEntryIds ?? []).flat(), ]); @@ -343,12 +339,14 @@ export const claimRewards = async ( rewardDistributorIds && rewardDistributorIds?.length > 0 ) { - tx.add( - createUpdateTotalStakeSecondsInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.updateTotalStakeSeconds() + .accounts({ stakeEntry: stakeEntryId, updater: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); for (let j = 0; j < rewardDistributorIds.length; j++) { const rewardDistributorId = rewardDistributorIds[j]!; const rewardDistributorData = @@ -375,8 +373,9 @@ export const claimRewards = async ( wallet.publicKey ); if (!rewardEntry) { - tx.add( - createInitRewardEntryInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.initRewardEntry() + .accounts({ rewardEntry: findRewardEntryId( rewardDistributorId, stakeEntryId @@ -385,7 +384,8 @@ export const claimRewards = async ( stakeEntry: stakeEntryId, payer: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); } const remainingAccountsForPayment = await withRemainingAccountsForPaymentInfo( @@ -394,24 +394,21 @@ export const claimRewards = async ( wallet.publicKey, rewardDistributorData.parsed.claimRewardsPaymentInfo ); - tx.add( - withRemainingAccounts( - createClaimRewardsInstruction({ - rewardEntry: findRewardEntryId( - rewardDistributorId, - stakeEntryId - ), - rewardDistributor: rewardDistributorId, - stakeEntry: stakeEntryId, - stakePool: stakePoolId, - rewardMint: rewardMint, - userRewardMintTokenAccount: userRewardMintTokenAccount, - rewardDistributorTokenAccount: rewardDistributorTokenAccount, - user: wallet.publicKey, - }), - remainingAccountsForPayment - ) - ); + const ix = await rewardsCenterProgram(connection, wallet) + .methods.claimRewards() + .accounts({ + rewardEntry: findRewardEntryId(rewardDistributorId, stakeEntryId), + rewardDistributor: rewardDistributorId, + stakeEntry: stakeEntryId, + stakePool: stakePoolId, + rewardMint: rewardMint, + userRewardMintTokenAccount: userRewardMintTokenAccount, + rewardDistributorTokenAccount: rewardDistributorTokenAccount, + user: wallet.publicKey, + }) + .remainingAccounts(remainingAccountsForPayment) + .instruction(); + tx.add(ix); } } } @@ -448,7 +445,7 @@ export const claimRewardReceipt = async ( ); const rewardReceiptId = findRewardReceiptId(receiptManagerId, stakeEntryId); - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ receiptManagerId, rewardReceiptId, ]); @@ -461,28 +458,34 @@ export const claimRewardReceipt = async ( } const tx = new Transaction(); - tx.add( - createUpdateTotalStakeSecondsInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.updateTotalStakeSeconds() + .accounts({ stakeEntry: stakeEntryId, updater: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); if (!accountDataById[rewardReceiptId.toString()]?.parsed) { - tx.add( - createInitRewardReceiptInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.initRewardReceipt() + .accounts({ rewardReceipt: rewardReceiptId, receiptManager: receiptManagerId, stakeEntry: stakeEntryId, payer: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); } const remainingAccountsForPayment = await withRemainingAccountsForPayment( connection, tx, wallet.publicKey, receiptManagerData.parsed.paymentMint, - receiptManagerData.parsed.paymentShares.map((p) => p.address) + (receiptManagerData.parsed.paymentShares as PaymentShare[]).map( + (p) => p.address + ) ); const remainingAccountsForAction = await withRemainingAccountsForPaymentInfo( @@ -491,18 +494,21 @@ export const claimRewardReceipt = async ( wallet.publicKey, receiptManagerData.parsed.claimActionPaymentInfo ); - tx.add( - withRemainingAccounts( - createClaimRewardReceiptInstruction({ - rewardReceipt: rewardReceiptId, - receiptManager: receiptManagerId, - stakeEntry: stakeEntryId, - payer: wallet.publicKey, - claimer: wallet.publicKey, - }), - [...remainingAccountsForPayment, ...remainingAccountsForAction] - ) - ); + const rewardReceiptIx = await rewardsCenterProgram(connection, wallet) + .methods.claimRewardReceipt() + .accounts({ + rewardReceipt: rewardReceiptId, + receiptManager: receiptManagerId, + stakeEntry: stakeEntryId, + payer: wallet.publicKey, + claimer: wallet.publicKey, + }) + .remainingAccounts([ + ...remainingAccountsForPayment, + ...remainingAccountsForAction, + ]) + .instruction(); + tx.add(rewardReceiptIx); return tx; }; @@ -539,7 +545,7 @@ export const boost = async ( stakeBoosterIdentifer ? new BN(stakeBoosterIdentifer) : undefined ); - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ stakeBoosterId, ]); const stakeBoosterData = accountDataById[stakeBoosterId.toString()]; @@ -548,19 +554,23 @@ export const boost = async ( } const tx = new Transaction(); - tx.add( - createUpdateTotalStakeSecondsInstruction({ + const ix = await rewardsCenterProgram(connection, wallet) + .methods.updateTotalStakeSeconds() + .accounts({ stakeEntry: stakeEntryId, updater: wallet.publicKey, }) - ); + .instruction(); + tx.add(ix); const remainingAccountsForPayment = await withRemainingAccountsForPayment( connection, tx, wallet.publicKey, stakeBoosterData.parsed.paymentMint, - stakeBoosterData.parsed.paymentShares.map((p) => p.address) + (stakeBoosterData.parsed.paymentShares as PaymentShare[]).map( + (p) => p.address + ) ); const remainingAccountsForAction = await withRemainingAccountsForPaymentInfo( @@ -569,23 +579,19 @@ export const boost = async ( wallet.publicKey, stakeBoosterData.parsed.boostActionPaymentInfo ); - tx.add( - withRemainingAccounts( - createBoostStakeEntryInstruction( - { - stakePool: stakePoolId, - stakeBooster: stakeBoosterId, - stakeEntry: stakeEntryId, - stakeMint: mintInfo.mintId, - }, - { - ix: { - secondsToBoost, - }, - } - ), - [...remainingAccountsForPayment, ...remainingAccountsForAction] - ) - ); + const boostIx = await rewardsCenterProgram(connection, wallet) + .methods.boostStakeEntry({ secondsToBoost: new BN(secondsToBoost) }) + .accounts({ + stakePool: stakePoolId, + stakeBooster: stakeBoosterId, + stakeEntry: stakeEntryId, + stakeMint: mintInfo.mintId, + }) + .remainingAccounts([ + ...remainingAccountsForPayment, + ...remainingAccountsForAction, + ]) + .instruction(); + tx.add(boostIx); return tx; }; diff --git a/sdk/constants.ts b/sdk/constants.ts index 41b87142..42a3ba5e 100644 --- a/sdk/constants.ts +++ b/sdk/constants.ts @@ -1,9 +1,23 @@ +import type { Idl } from "@project-serum/anchor"; +import { AnchorProvider, Program } from "@project-serum/anchor"; +import type { + AllAccountsMap, + IdlTypes, + TypeDef, +} from "@project-serum/anchor/dist/cjs/program/namespace/types"; +import type { Wallet } from "@project-serum/anchor/dist/cjs/provider"; +import type { AccountInfo, ConfirmOptions, Connection } from "@solana/web3.js"; import { PublicKey } from "@solana/web3.js"; +import type { CardinalRewardsCenter } from "./idl/cardinal_rewards_center"; import { IDL } from "./idl/cardinal_rewards_center"; export const REWARDS_CENTER_IDL = IDL; +export const REWARDS_CENTER_ADDRESS = new PublicKey( + "rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U" +); + export const SOL_PAYMENT_INFO = new PublicKey( "3dxFgrZt9DLn1J5ZB1bDwjeDvbESzNxA11KggRcywKbm" ); @@ -16,6 +30,45 @@ export const DUST_PAYMENT_INFO = new PublicKey( "AmJdpbtEzFBVWhznaEQM3V4fNZBa8FWj36Lu2BtnaDYt" ); +export type IDLAccountInfo = { + [T in keyof AllAccountsMap]: AccountInfo & { + type: T; + parsed: TypeDef[T], IdlTypes>; + }; +}; + +export type IDLAccount = { + [T in keyof AllAccountsMap]: { + pubkey: PublicKey; + } & IDLAccountInfo[T]; +}; + export const CLAIM_REWARDS_PAYMENT_INFO = new PublicKey( "CUeHFsFqfbLfBGSbuNbaAi4wK6V835PoRg1CqCLo8tpM" ); + +export type RewardDistributor = IDLAccount["rewardDistributor"]; +export type RewardEntry = IDLAccount["rewardEntry"]; +export type StakePool = IDLAccount["stakePool"]; +export type StakeEntry = IDLAccount["stakeEntry"]; +export type ReceiptManager = IDLAccount["receiptManager"]; +export type RewardReceipt = IDLAccount["rewardReceipt"]; +export type StakeBooster = IDLAccount["stakeBooster"]; +export type StakeAuthorizationRecord = IDLAccount["stakeAuthorizationRecord"]; +export type PaymentInfo = IDLAccount["paymentInfo"]; +export type PaymentShare = { + address: PublicKey; + basisPoints: number; +}; + +export const rewardsCenterProgram = ( + connection: Connection, + wallet: Wallet, + opts?: ConfirmOptions +) => { + return new Program( + REWARDS_CENTER_IDL, + REWARDS_CENTER_ADDRESS, + new AnchorProvider(connection, wallet, opts ?? {}) + ); +}; diff --git a/sdk/generated/accounts/PaymentInfo.ts b/sdk/generated/accounts/PaymentInfo.ts deleted file mode 100644 index 7ad24003..00000000 --- a/sdk/generated/accounts/PaymentInfo.ts +++ /dev/null @@ -1,201 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from '../types/PaymentShare' - -/** - * Arguments used to create {@link PaymentInfo} - * @category Accounts - * @category generated - */ -export type PaymentInfoArgs = { - bump: number - authority: web3.PublicKey - identifier: string - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] -} - -export const paymentInfoDiscriminator = [143, 125, 192, 198, 144, 195, 58, 175] -/** - * Holds the data for the {@link PaymentInfo} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class PaymentInfo implements PaymentInfoArgs { - private constructor( - readonly bump: number, - readonly authority: web3.PublicKey, - readonly identifier: string, - readonly paymentAmount: beet.bignum, - readonly paymentMint: web3.PublicKey, - readonly paymentShares: PaymentShare[] - ) {} - - /** - * Creates a {@link PaymentInfo} instance from the provided args. - */ - static fromArgs(args: PaymentInfoArgs) { - return new PaymentInfo( - args.bump, - args.authority, - args.identifier, - args.paymentAmount, - args.paymentMint, - args.paymentShares - ) - } - - /** - * Deserializes the {@link PaymentInfo} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [PaymentInfo, number] { - return PaymentInfo.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link PaymentInfo} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find PaymentInfo account at ${address}`) - } - return PaymentInfo.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, paymentInfoBeet) - } - - /** - * Deserializes the {@link PaymentInfo} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [PaymentInfo, number] { - return paymentInfoBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link PaymentInfo} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return paymentInfoBeet.serialize({ - accountDiscriminator: paymentInfoDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link PaymentInfo} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: PaymentInfoArgs) { - const instance = PaymentInfo.fromArgs(args) - return paymentInfoBeet.toFixedFromValue({ - accountDiscriminator: paymentInfoDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link PaymentInfo} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: PaymentInfoArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - PaymentInfo.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link PaymentInfo} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - authority: this.authority.toBase58(), - identifier: this.identifier, - paymentAmount: (() => { - const x = <{ toNumber: () => number }>this.paymentAmount - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - paymentMint: this.paymentMint.toBase58(), - paymentShares: this.paymentShares, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const paymentInfoBeet = new beet.FixableBeetStruct< - PaymentInfo, - PaymentInfoArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['authority', beetSolana.publicKey], - ['identifier', beet.utf8String], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ], - PaymentInfo.fromArgs, - 'PaymentInfo' -) diff --git a/sdk/generated/accounts/ReceiptManager.ts b/sdk/generated/accounts/ReceiptManager.ts deleted file mode 100644 index 0168a3b9..00000000 --- a/sdk/generated/accounts/ReceiptManager.ts +++ /dev/null @@ -1,268 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from '../types/PaymentShare' - -/** - * Arguments used to create {@link ReceiptManager} - * @category Accounts - * @category generated - */ -export type ReceiptManagerArgs = { - bump: number - stakePool: web3.PublicKey - authority: web3.PublicKey - requiredStakeSeconds: beet.bignum - stakeSecondsToUse: beet.bignum - claimedReceiptsCounter: beet.bignum - requiresAuthorization: boolean - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] - claimActionPaymentInfo: web3.PublicKey - name: string - maxClaimedReceipts: beet.COption -} - -export const receiptManagerDiscriminator = [ - 153, 143, 251, 115, 216, 68, 70, 152, -] -/** - * Holds the data for the {@link ReceiptManager} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class ReceiptManager implements ReceiptManagerArgs { - private constructor( - readonly bump: number, - readonly stakePool: web3.PublicKey, - readonly authority: web3.PublicKey, - readonly requiredStakeSeconds: beet.bignum, - readonly stakeSecondsToUse: beet.bignum, - readonly claimedReceiptsCounter: beet.bignum, - readonly requiresAuthorization: boolean, - readonly paymentAmount: beet.bignum, - readonly paymentMint: web3.PublicKey, - readonly paymentShares: PaymentShare[], - readonly claimActionPaymentInfo: web3.PublicKey, - readonly name: string, - readonly maxClaimedReceipts: beet.COption - ) {} - - /** - * Creates a {@link ReceiptManager} instance from the provided args. - */ - static fromArgs(args: ReceiptManagerArgs) { - return new ReceiptManager( - args.bump, - args.stakePool, - args.authority, - args.requiredStakeSeconds, - args.stakeSecondsToUse, - args.claimedReceiptsCounter, - args.requiresAuthorization, - args.paymentAmount, - args.paymentMint, - args.paymentShares, - args.claimActionPaymentInfo, - args.name, - args.maxClaimedReceipts - ) - } - - /** - * Deserializes the {@link ReceiptManager} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [ReceiptManager, number] { - return ReceiptManager.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link ReceiptManager} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find ReceiptManager account at ${address}`) - } - return ReceiptManager.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, receiptManagerBeet) - } - - /** - * Deserializes the {@link ReceiptManager} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [ReceiptManager, number] { - return receiptManagerBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link ReceiptManager} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return receiptManagerBeet.serialize({ - accountDiscriminator: receiptManagerDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link ReceiptManager} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: ReceiptManagerArgs) { - const instance = ReceiptManager.fromArgs(args) - return receiptManagerBeet.toFixedFromValue({ - accountDiscriminator: receiptManagerDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link ReceiptManager} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: ReceiptManagerArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - ReceiptManager.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link ReceiptManager} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - stakePool: this.stakePool.toBase58(), - authority: this.authority.toBase58(), - requiredStakeSeconds: (() => { - const x = <{ toNumber: () => number }>this.requiredStakeSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - stakeSecondsToUse: (() => { - const x = <{ toNumber: () => number }>this.stakeSecondsToUse - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - claimedReceiptsCounter: (() => { - const x = <{ toNumber: () => number }>this.claimedReceiptsCounter - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - requiresAuthorization: this.requiresAuthorization, - paymentAmount: (() => { - const x = <{ toNumber: () => number }>this.paymentAmount - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - paymentMint: this.paymentMint.toBase58(), - paymentShares: this.paymentShares, - claimActionPaymentInfo: this.claimActionPaymentInfo.toBase58(), - name: this.name, - maxClaimedReceipts: this.maxClaimedReceipts, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const receiptManagerBeet = new beet.FixableBeetStruct< - ReceiptManager, - ReceiptManagerArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['stakePool', beetSolana.publicKey], - ['authority', beetSolana.publicKey], - ['requiredStakeSeconds', beet.u128], - ['stakeSecondsToUse', beet.u128], - ['claimedReceiptsCounter', beet.u128], - ['requiresAuthorization', beet.bool], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ['claimActionPaymentInfo', beetSolana.publicKey], - ['name', beet.utf8String], - ['maxClaimedReceipts', beet.coption(beet.u128)], - ], - ReceiptManager.fromArgs, - 'ReceiptManager' -) diff --git a/sdk/generated/accounts/RewardDistributor.ts b/sdk/generated/accounts/RewardDistributor.ts deleted file mode 100644 index 151879fc..00000000 --- a/sdk/generated/accounts/RewardDistributor.ts +++ /dev/null @@ -1,277 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link RewardDistributor} - * @category Accounts - * @category generated - */ -export type RewardDistributorArgs = { - bump: number - stakePool: web3.PublicKey - kind: number - authority: web3.PublicKey - identifier: beet.bignum - rewardMint: web3.PublicKey - rewardAmount: beet.bignum - rewardDurationSeconds: beet.bignum - rewardsIssued: beet.bignum - defaultMultiplier: beet.bignum - multiplierDecimals: number - claimRewardsPaymentInfo: web3.PublicKey - maxRewardSecondsReceived: beet.COption -} - -export const rewardDistributorDiscriminator = [ - 215, 10, 217, 199, 104, 194, 97, 227, -] -/** - * Holds the data for the {@link RewardDistributor} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class RewardDistributor implements RewardDistributorArgs { - private constructor( - readonly bump: number, - readonly stakePool: web3.PublicKey, - readonly kind: number, - readonly authority: web3.PublicKey, - readonly identifier: beet.bignum, - readonly rewardMint: web3.PublicKey, - readonly rewardAmount: beet.bignum, - readonly rewardDurationSeconds: beet.bignum, - readonly rewardsIssued: beet.bignum, - readonly defaultMultiplier: beet.bignum, - readonly multiplierDecimals: number, - readonly claimRewardsPaymentInfo: web3.PublicKey, - readonly maxRewardSecondsReceived: beet.COption - ) {} - - /** - * Creates a {@link RewardDistributor} instance from the provided args. - */ - static fromArgs(args: RewardDistributorArgs) { - return new RewardDistributor( - args.bump, - args.stakePool, - args.kind, - args.authority, - args.identifier, - args.rewardMint, - args.rewardAmount, - args.rewardDurationSeconds, - args.rewardsIssued, - args.defaultMultiplier, - args.multiplierDecimals, - args.claimRewardsPaymentInfo, - args.maxRewardSecondsReceived - ) - } - - /** - * Deserializes the {@link RewardDistributor} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [RewardDistributor, number] { - return RewardDistributor.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link RewardDistributor} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find RewardDistributor account at ${address}`) - } - return RewardDistributor.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, rewardDistributorBeet) - } - - /** - * Deserializes the {@link RewardDistributor} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [RewardDistributor, number] { - return rewardDistributorBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link RewardDistributor} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return rewardDistributorBeet.serialize({ - accountDiscriminator: rewardDistributorDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link RewardDistributor} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: RewardDistributorArgs) { - const instance = RewardDistributor.fromArgs(args) - return rewardDistributorBeet.toFixedFromValue({ - accountDiscriminator: rewardDistributorDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link RewardDistributor} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: RewardDistributorArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - RewardDistributor.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link RewardDistributor} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - stakePool: this.stakePool.toBase58(), - kind: this.kind, - authority: this.authority.toBase58(), - identifier: (() => { - const x = <{ toNumber: () => number }>this.identifier - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - rewardMint: this.rewardMint.toBase58(), - rewardAmount: (() => { - const x = <{ toNumber: () => number }>this.rewardAmount - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - rewardDurationSeconds: (() => { - const x = <{ toNumber: () => number }>this.rewardDurationSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - rewardsIssued: (() => { - const x = <{ toNumber: () => number }>this.rewardsIssued - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - defaultMultiplier: (() => { - const x = <{ toNumber: () => number }>this.defaultMultiplier - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - multiplierDecimals: this.multiplierDecimals, - claimRewardsPaymentInfo: this.claimRewardsPaymentInfo.toBase58(), - maxRewardSecondsReceived: this.maxRewardSecondsReceived, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const rewardDistributorBeet = new beet.FixableBeetStruct< - RewardDistributor, - RewardDistributorArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['stakePool', beetSolana.publicKey], - ['kind', beet.u8], - ['authority', beetSolana.publicKey], - ['identifier', beet.u64], - ['rewardMint', beetSolana.publicKey], - ['rewardAmount', beet.u64], - ['rewardDurationSeconds', beet.u128], - ['rewardsIssued', beet.u128], - ['defaultMultiplier', beet.u64], - ['multiplierDecimals', beet.u8], - ['claimRewardsPaymentInfo', beetSolana.publicKey], - ['maxRewardSecondsReceived', beet.coption(beet.u128)], - ], - RewardDistributor.fromArgs, - 'RewardDistributor' -) diff --git a/sdk/generated/accounts/RewardEntry.ts b/sdk/generated/accounts/RewardEntry.ts deleted file mode 100644 index d44b0344..00000000 --- a/sdk/generated/accounts/RewardEntry.ts +++ /dev/null @@ -1,203 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link RewardEntry} - * @category Accounts - * @category generated - */ -export type RewardEntryArgs = { - bump: number - stakeEntry: web3.PublicKey - rewardDistributor: web3.PublicKey - rewardSecondsReceived: beet.bignum - multiplier: beet.bignum -} - -export const rewardEntryDiscriminator = [208, 191, 173, 14, 213, 84, 179, 162] -/** - * Holds the data for the {@link RewardEntry} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class RewardEntry implements RewardEntryArgs { - private constructor( - readonly bump: number, - readonly stakeEntry: web3.PublicKey, - readonly rewardDistributor: web3.PublicKey, - readonly rewardSecondsReceived: beet.bignum, - readonly multiplier: beet.bignum - ) {} - - /** - * Creates a {@link RewardEntry} instance from the provided args. - */ - static fromArgs(args: RewardEntryArgs) { - return new RewardEntry( - args.bump, - args.stakeEntry, - args.rewardDistributor, - args.rewardSecondsReceived, - args.multiplier - ) - } - - /** - * Deserializes the {@link RewardEntry} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [RewardEntry, number] { - return RewardEntry.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link RewardEntry} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find RewardEntry account at ${address}`) - } - return RewardEntry.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, rewardEntryBeet) - } - - /** - * Deserializes the {@link RewardEntry} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [RewardEntry, number] { - return rewardEntryBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link RewardEntry} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return rewardEntryBeet.serialize({ - accountDiscriminator: rewardEntryDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link RewardEntry} - */ - static get byteSize() { - return rewardEntryBeet.byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link RewardEntry} data from rent - * - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - RewardEntry.byteSize, - commitment - ) - } - - /** - * Determines if the provided {@link Buffer} has the correct byte size to - * hold {@link RewardEntry} data. - */ - static hasCorrectByteSize(buf: Buffer, offset = 0) { - return buf.byteLength - offset === RewardEntry.byteSize - } - - /** - * Returns a readable version of {@link RewardEntry} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - stakeEntry: this.stakeEntry.toBase58(), - rewardDistributor: this.rewardDistributor.toBase58(), - rewardSecondsReceived: (() => { - const x = <{ toNumber: () => number }>this.rewardSecondsReceived - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - multiplier: (() => { - const x = <{ toNumber: () => number }>this.multiplier - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const rewardEntryBeet = new beet.BeetStruct< - RewardEntry, - RewardEntryArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['stakeEntry', beetSolana.publicKey], - ['rewardDistributor', beetSolana.publicKey], - ['rewardSecondsReceived', beet.u128], - ['multiplier', beet.u64], - ], - RewardEntry.fromArgs, - 'RewardEntry' -) diff --git a/sdk/generated/accounts/RewardReceipt.ts b/sdk/generated/accounts/RewardReceipt.ts deleted file mode 100644 index 1576960e..00000000 --- a/sdk/generated/accounts/RewardReceipt.ts +++ /dev/null @@ -1,183 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link RewardReceipt} - * @category Accounts - * @category generated - */ -export type RewardReceiptArgs = { - bump: number - stakeEntry: web3.PublicKey - receiptManager: web3.PublicKey - target: web3.PublicKey - allowed: boolean -} - -export const rewardReceiptDiscriminator = [116, 154, 221, 22, 195, 73, 132, 89] -/** - * Holds the data for the {@link RewardReceipt} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class RewardReceipt implements RewardReceiptArgs { - private constructor( - readonly bump: number, - readonly stakeEntry: web3.PublicKey, - readonly receiptManager: web3.PublicKey, - readonly target: web3.PublicKey, - readonly allowed: boolean - ) {} - - /** - * Creates a {@link RewardReceipt} instance from the provided args. - */ - static fromArgs(args: RewardReceiptArgs) { - return new RewardReceipt( - args.bump, - args.stakeEntry, - args.receiptManager, - args.target, - args.allowed - ) - } - - /** - * Deserializes the {@link RewardReceipt} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [RewardReceipt, number] { - return RewardReceipt.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link RewardReceipt} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find RewardReceipt account at ${address}`) - } - return RewardReceipt.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, rewardReceiptBeet) - } - - /** - * Deserializes the {@link RewardReceipt} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [RewardReceipt, number] { - return rewardReceiptBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link RewardReceipt} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return rewardReceiptBeet.serialize({ - accountDiscriminator: rewardReceiptDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link RewardReceipt} - */ - static get byteSize() { - return rewardReceiptBeet.byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link RewardReceipt} data from rent - * - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - RewardReceipt.byteSize, - commitment - ) - } - - /** - * Determines if the provided {@link Buffer} has the correct byte size to - * hold {@link RewardReceipt} data. - */ - static hasCorrectByteSize(buf: Buffer, offset = 0) { - return buf.byteLength - offset === RewardReceipt.byteSize - } - - /** - * Returns a readable version of {@link RewardReceipt} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - stakeEntry: this.stakeEntry.toBase58(), - receiptManager: this.receiptManager.toBase58(), - target: this.target.toBase58(), - allowed: this.allowed, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const rewardReceiptBeet = new beet.BeetStruct< - RewardReceipt, - RewardReceiptArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['stakeEntry', beetSolana.publicKey], - ['receiptManager', beetSolana.publicKey], - ['target', beetSolana.publicKey], - ['allowed', beet.bool], - ], - RewardReceipt.fromArgs, - 'RewardReceipt' -) diff --git a/sdk/generated/accounts/StakeAuthorizationRecord.ts b/sdk/generated/accounts/StakeAuthorizationRecord.ts deleted file mode 100644 index 6a272ef4..00000000 --- a/sdk/generated/accounts/StakeAuthorizationRecord.ts +++ /dev/null @@ -1,179 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link StakeAuthorizationRecord} - * @category Accounts - * @category generated - */ -export type StakeAuthorizationRecordArgs = { - bump: number - pool: web3.PublicKey - mint: web3.PublicKey -} - -export const stakeAuthorizationRecordDiscriminator = [ - 36, 54, 48, 7, 224, 193, 207, 76, -] -/** - * Holds the data for the {@link StakeAuthorizationRecord} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class StakeAuthorizationRecord implements StakeAuthorizationRecordArgs { - private constructor( - readonly bump: number, - readonly pool: web3.PublicKey, - readonly mint: web3.PublicKey - ) {} - - /** - * Creates a {@link StakeAuthorizationRecord} instance from the provided args. - */ - static fromArgs(args: StakeAuthorizationRecordArgs) { - return new StakeAuthorizationRecord(args.bump, args.pool, args.mint) - } - - /** - * Deserializes the {@link StakeAuthorizationRecord} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [StakeAuthorizationRecord, number] { - return StakeAuthorizationRecord.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link StakeAuthorizationRecord} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error( - `Unable to find StakeAuthorizationRecord account at ${address}` - ) - } - return StakeAuthorizationRecord.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct( - programId, - stakeAuthorizationRecordBeet - ) - } - - /** - * Deserializes the {@link StakeAuthorizationRecord} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize( - buf: Buffer, - offset = 0 - ): [StakeAuthorizationRecord, number] { - return stakeAuthorizationRecordBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link StakeAuthorizationRecord} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return stakeAuthorizationRecordBeet.serialize({ - accountDiscriminator: stakeAuthorizationRecordDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link StakeAuthorizationRecord} - */ - static get byteSize() { - return stakeAuthorizationRecordBeet.byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link StakeAuthorizationRecord} data from rent - * - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - StakeAuthorizationRecord.byteSize, - commitment - ) - } - - /** - * Determines if the provided {@link Buffer} has the correct byte size to - * hold {@link StakeAuthorizationRecord} data. - */ - static hasCorrectByteSize(buf: Buffer, offset = 0) { - return buf.byteLength - offset === StakeAuthorizationRecord.byteSize - } - - /** - * Returns a readable version of {@link StakeAuthorizationRecord} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - pool: this.pool.toBase58(), - mint: this.mint.toBase58(), - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const stakeAuthorizationRecordBeet = new beet.BeetStruct< - StakeAuthorizationRecord, - StakeAuthorizationRecordArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['pool', beetSolana.publicKey], - ['mint', beetSolana.publicKey], - ], - StakeAuthorizationRecord.fromArgs, - 'StakeAuthorizationRecord' -) diff --git a/sdk/generated/accounts/StakeBooster.ts b/sdk/generated/accounts/StakeBooster.ts deleted file mode 100644 index 2f0f9813..00000000 --- a/sdk/generated/accounts/StakeBooster.ts +++ /dev/null @@ -1,246 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from '../types/PaymentShare' - -/** - * Arguments used to create {@link StakeBooster} - * @category Accounts - * @category generated - */ -export type StakeBoosterArgs = { - bump: number - stakePool: web3.PublicKey - identifier: beet.bignum - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] - boostSeconds: beet.bignum - startTimeSeconds: beet.bignum - boostActionPaymentInfo: web3.PublicKey -} - -export const stakeBoosterDiscriminator = [133, 242, 13, 224, 46, 151, 169, 50] -/** - * Holds the data for the {@link StakeBooster} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class StakeBooster implements StakeBoosterArgs { - private constructor( - readonly bump: number, - readonly stakePool: web3.PublicKey, - readonly identifier: beet.bignum, - readonly paymentAmount: beet.bignum, - readonly paymentMint: web3.PublicKey, - readonly paymentShares: PaymentShare[], - readonly boostSeconds: beet.bignum, - readonly startTimeSeconds: beet.bignum, - readonly boostActionPaymentInfo: web3.PublicKey - ) {} - - /** - * Creates a {@link StakeBooster} instance from the provided args. - */ - static fromArgs(args: StakeBoosterArgs) { - return new StakeBooster( - args.bump, - args.stakePool, - args.identifier, - args.paymentAmount, - args.paymentMint, - args.paymentShares, - args.boostSeconds, - args.startTimeSeconds, - args.boostActionPaymentInfo - ) - } - - /** - * Deserializes the {@link StakeBooster} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [StakeBooster, number] { - return StakeBooster.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link StakeBooster} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find StakeBooster account at ${address}`) - } - return StakeBooster.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, stakeBoosterBeet) - } - - /** - * Deserializes the {@link StakeBooster} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [StakeBooster, number] { - return stakeBoosterBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link StakeBooster} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return stakeBoosterBeet.serialize({ - accountDiscriminator: stakeBoosterDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link StakeBooster} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: StakeBoosterArgs) { - const instance = StakeBooster.fromArgs(args) - return stakeBoosterBeet.toFixedFromValue({ - accountDiscriminator: stakeBoosterDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link StakeBooster} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: StakeBoosterArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - StakeBooster.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link StakeBooster} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - stakePool: this.stakePool.toBase58(), - identifier: (() => { - const x = <{ toNumber: () => number }>this.identifier - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - paymentAmount: (() => { - const x = <{ toNumber: () => number }>this.paymentAmount - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - paymentMint: this.paymentMint.toBase58(), - paymentShares: this.paymentShares, - boostSeconds: (() => { - const x = <{ toNumber: () => number }>this.boostSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - startTimeSeconds: (() => { - const x = <{ toNumber: () => number }>this.startTimeSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - boostActionPaymentInfo: this.boostActionPaymentInfo.toBase58(), - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const stakeBoosterBeet = new beet.FixableBeetStruct< - StakeBooster, - StakeBoosterArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['stakePool', beetSolana.publicKey], - ['identifier', beet.u64], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ['boostSeconds', beet.u128], - ['startTimeSeconds', beet.i64], - ['boostActionPaymentInfo', beetSolana.publicKey], - ], - StakeBooster.fromArgs, - 'StakeBooster' -) diff --git a/sdk/generated/accounts/StakeEntry.ts b/sdk/generated/accounts/StakeEntry.ts deleted file mode 100644 index adf0d4f8..00000000 --- a/sdk/generated/accounts/StakeEntry.ts +++ /dev/null @@ -1,265 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link StakeEntry} - * @category Accounts - * @category generated - */ -export type StakeEntryArgs = { - bump: number - kind: number - pool: web3.PublicKey - amount: beet.bignum - stakeMint: web3.PublicKey - lastStaker: web3.PublicKey - lastStakedAt: beet.bignum - lastUpdatedAt: beet.bignum - totalStakeSeconds: beet.bignum - usedStakeSeconds: beet.bignum - cooldownStartSeconds: beet.COption -} - -export const stakeEntryDiscriminator = [187, 127, 9, 35, 155, 68, 86, 40] -/** - * Holds the data for the {@link StakeEntry} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class StakeEntry implements StakeEntryArgs { - private constructor( - readonly bump: number, - readonly kind: number, - readonly pool: web3.PublicKey, - readonly amount: beet.bignum, - readonly stakeMint: web3.PublicKey, - readonly lastStaker: web3.PublicKey, - readonly lastStakedAt: beet.bignum, - readonly lastUpdatedAt: beet.bignum, - readonly totalStakeSeconds: beet.bignum, - readonly usedStakeSeconds: beet.bignum, - readonly cooldownStartSeconds: beet.COption - ) {} - - /** - * Creates a {@link StakeEntry} instance from the provided args. - */ - static fromArgs(args: StakeEntryArgs) { - return new StakeEntry( - args.bump, - args.kind, - args.pool, - args.amount, - args.stakeMint, - args.lastStaker, - args.lastStakedAt, - args.lastUpdatedAt, - args.totalStakeSeconds, - args.usedStakeSeconds, - args.cooldownStartSeconds - ) - } - - /** - * Deserializes the {@link StakeEntry} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [StakeEntry, number] { - return StakeEntry.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link StakeEntry} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find StakeEntry account at ${address}`) - } - return StakeEntry.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, stakeEntryBeet) - } - - /** - * Deserializes the {@link StakeEntry} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [StakeEntry, number] { - return stakeEntryBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link StakeEntry} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return stakeEntryBeet.serialize({ - accountDiscriminator: stakeEntryDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link StakeEntry} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: StakeEntryArgs) { - const instance = StakeEntry.fromArgs(args) - return stakeEntryBeet.toFixedFromValue({ - accountDiscriminator: stakeEntryDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link StakeEntry} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: StakeEntryArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - StakeEntry.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link StakeEntry} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - kind: this.kind, - pool: this.pool.toBase58(), - amount: (() => { - const x = <{ toNumber: () => number }>this.amount - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - stakeMint: this.stakeMint.toBase58(), - lastStaker: this.lastStaker.toBase58(), - lastStakedAt: (() => { - const x = <{ toNumber: () => number }>this.lastStakedAt - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - lastUpdatedAt: (() => { - const x = <{ toNumber: () => number }>this.lastUpdatedAt - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - totalStakeSeconds: (() => { - const x = <{ toNumber: () => number }>this.totalStakeSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - usedStakeSeconds: (() => { - const x = <{ toNumber: () => number }>this.usedStakeSeconds - if (typeof x.toNumber === 'function') { - try { - return x.toNumber() - } catch (_) { - return x - } - } - return x - })(), - cooldownStartSeconds: this.cooldownStartSeconds, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const stakeEntryBeet = new beet.FixableBeetStruct< - StakeEntry, - StakeEntryArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['kind', beet.u8], - ['pool', beetSolana.publicKey], - ['amount', beet.u64], - ['stakeMint', beetSolana.publicKey], - ['lastStaker', beetSolana.publicKey], - ['lastStakedAt', beet.i64], - ['lastUpdatedAt', beet.i64], - ['totalStakeSeconds', beet.u128], - ['usedStakeSeconds', beet.u128], - ['cooldownStartSeconds', beet.coption(beet.i64)], - ], - StakeEntry.fromArgs, - 'StakeEntry' -) diff --git a/sdk/generated/accounts/StakePool.ts b/sdk/generated/accounts/StakePool.ts deleted file mode 100644 index 826c60ef..00000000 --- a/sdk/generated/accounts/StakePool.ts +++ /dev/null @@ -1,225 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' - -/** - * Arguments used to create {@link StakePool} - * @category Accounts - * @category generated - */ -export type StakePoolArgs = { - bump: number - authority: web3.PublicKey - totalStaked: number - resetOnUnstake: boolean - cooldownSeconds: beet.COption - minStakeSeconds: beet.COption - endDate: beet.COption - stakePaymentInfo: web3.PublicKey - unstakePaymentInfo: web3.PublicKey - requiresAuthorization: boolean - allowedCreators: web3.PublicKey[] - allowedCollections: web3.PublicKey[] - identifier: string -} - -export const stakePoolDiscriminator = [121, 34, 206, 21, 79, 127, 255, 28] -/** - * Holds the data for the {@link StakePool} Account and provides de/serialization - * functionality for that data - * - * @category Accounts - * @category generated - */ -export class StakePool implements StakePoolArgs { - private constructor( - readonly bump: number, - readonly authority: web3.PublicKey, - readonly totalStaked: number, - readonly resetOnUnstake: boolean, - readonly cooldownSeconds: beet.COption, - readonly minStakeSeconds: beet.COption, - readonly endDate: beet.COption, - readonly stakePaymentInfo: web3.PublicKey, - readonly unstakePaymentInfo: web3.PublicKey, - readonly requiresAuthorization: boolean, - readonly allowedCreators: web3.PublicKey[], - readonly allowedCollections: web3.PublicKey[], - readonly identifier: string - ) {} - - /** - * Creates a {@link StakePool} instance from the provided args. - */ - static fromArgs(args: StakePoolArgs) { - return new StakePool( - args.bump, - args.authority, - args.totalStaked, - args.resetOnUnstake, - args.cooldownSeconds, - args.minStakeSeconds, - args.endDate, - args.stakePaymentInfo, - args.unstakePaymentInfo, - args.requiresAuthorization, - args.allowedCreators, - args.allowedCollections, - args.identifier - ) - } - - /** - * Deserializes the {@link StakePool} from the data of the provided {@link web3.AccountInfo}. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static fromAccountInfo( - accountInfo: web3.AccountInfo, - offset = 0 - ): [StakePool, number] { - return StakePool.deserialize(accountInfo.data, offset) - } - - /** - * Retrieves the account info from the provided address and deserializes - * the {@link StakePool} from its data. - * - * @throws Error if no account info is found at the address or if deserialization fails - */ - static async fromAccountAddress( - connection: web3.Connection, - address: web3.PublicKey - ): Promise { - const accountInfo = await connection.getAccountInfo(address) - if (accountInfo == null) { - throw new Error(`Unable to find StakePool account at ${address}`) - } - return StakePool.fromAccountInfo(accountInfo, 0)[0] - } - - /** - * Provides a {@link web3.Connection.getProgramAccounts} config builder, - * to fetch accounts matching filters that can be specified via that builder. - * - * @param programId - the program that owns the accounts we are filtering - */ - static gpaBuilder( - programId: web3.PublicKey = new web3.PublicKey( - 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - ) - ) { - return beetSolana.GpaBuilder.fromStruct(programId, stakePoolBeet) - } - - /** - * Deserializes the {@link StakePool} from the provided data Buffer. - * @returns a tuple of the account data and the offset up to which the buffer was read to obtain it. - */ - static deserialize(buf: Buffer, offset = 0): [StakePool, number] { - return stakePoolBeet.deserialize(buf, offset) - } - - /** - * Serializes the {@link StakePool} into a Buffer. - * @returns a tuple of the created Buffer and the offset up to which the buffer was written to store it. - */ - serialize(): [Buffer, number] { - return stakePoolBeet.serialize({ - accountDiscriminator: stakePoolDiscriminator, - ...this, - }) - } - - /** - * Returns the byteSize of a {@link Buffer} holding the serialized data of - * {@link StakePool} for the provided args. - * - * @param args need to be provided since the byte size for this account - * depends on them - */ - static byteSize(args: StakePoolArgs) { - const instance = StakePool.fromArgs(args) - return stakePoolBeet.toFixedFromValue({ - accountDiscriminator: stakePoolDiscriminator, - ...instance, - }).byteSize - } - - /** - * Fetches the minimum balance needed to exempt an account holding - * {@link StakePool} data from rent - * - * @param args need to be provided since the byte size for this account - * depends on them - * @param connection used to retrieve the rent exemption information - */ - static async getMinimumBalanceForRentExemption( - args: StakePoolArgs, - connection: web3.Connection, - commitment?: web3.Commitment - ): Promise { - return connection.getMinimumBalanceForRentExemption( - StakePool.byteSize(args), - commitment - ) - } - - /** - * Returns a readable version of {@link StakePool} properties - * and can be used to convert to JSON and/or logging - */ - pretty() { - return { - bump: this.bump, - authority: this.authority.toBase58(), - totalStaked: this.totalStaked, - resetOnUnstake: this.resetOnUnstake, - cooldownSeconds: this.cooldownSeconds, - minStakeSeconds: this.minStakeSeconds, - endDate: this.endDate, - stakePaymentInfo: this.stakePaymentInfo.toBase58(), - unstakePaymentInfo: this.unstakePaymentInfo.toBase58(), - requiresAuthorization: this.requiresAuthorization, - allowedCreators: this.allowedCreators, - allowedCollections: this.allowedCollections, - identifier: this.identifier, - } - } -} - -/** - * @category Accounts - * @category generated - */ -export const stakePoolBeet = new beet.FixableBeetStruct< - StakePool, - StakePoolArgs & { - accountDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['bump', beet.u8], - ['authority', beetSolana.publicKey], - ['totalStaked', beet.u32], - ['resetOnUnstake', beet.bool], - ['cooldownSeconds', beet.coption(beet.u32)], - ['minStakeSeconds', beet.coption(beet.u32)], - ['endDate', beet.coption(beet.i64)], - ['stakePaymentInfo', beetSolana.publicKey], - ['unstakePaymentInfo', beetSolana.publicKey], - ['requiresAuthorization', beet.bool], - ['allowedCreators', beet.array(beetSolana.publicKey)], - ['allowedCollections', beet.array(beetSolana.publicKey)], - ['identifier', beet.utf8String], - ], - StakePool.fromArgs, - 'StakePool' -) diff --git a/sdk/generated/accounts/index.ts b/sdk/generated/accounts/index.ts deleted file mode 100644 index 30298129..00000000 --- a/sdk/generated/accounts/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -export * from './PaymentInfo' -export * from './ReceiptManager' -export * from './RewardDistributor' -export * from './RewardEntry' -export * from './RewardReceipt' -export * from './StakeAuthorizationRecord' -export * from './StakeBooster' -export * from './StakeEntry' -export * from './StakePool' - -import { StakeAuthorizationRecord } from './StakeAuthorizationRecord' -import { PaymentInfo } from './PaymentInfo' -import { RewardEntry } from './RewardEntry' -import { RewardDistributor } from './RewardDistributor' -import { ReceiptManager } from './ReceiptManager' -import { RewardReceipt } from './RewardReceipt' -import { StakeBooster } from './StakeBooster' -import { StakeEntry } from './StakeEntry' -import { StakePool } from './StakePool' - -export const accountProviders = { - StakeAuthorizationRecord, - PaymentInfo, - RewardEntry, - RewardDistributor, - ReceiptManager, - RewardReceipt, - StakeBooster, - StakeEntry, - StakePool, -} diff --git a/sdk/generated/errors/index.ts b/sdk/generated/errors/index.ts deleted file mode 100644 index 49ada861..00000000 --- a/sdk/generated/errors/index.ts +++ /dev/null @@ -1,1282 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -type ErrorWithCode = Error & { code: number } -type MaybeErrorWithCode = ErrorWithCode | null | undefined - -const createErrorFromCodeLookup: Map ErrorWithCode> = new Map() -const createErrorFromNameLookup: Map ErrorWithCode> = new Map() - -/** - * InvalidStakePool: 'Invalid stake pool' - * - * @category Errors - * @category generated - */ -export class InvalidStakePoolError extends Error { - readonly code: number = 0x1770 - readonly name: string = 'InvalidStakePool' - constructor() { - super('Invalid stake pool') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidStakePoolError) - } - } -} - -createErrorFromCodeLookup.set(0x1770, () => new InvalidStakePoolError()) -createErrorFromNameLookup.set( - 'InvalidStakePool', - () => new InvalidStakePoolError() -) - -/** - * InvalidStakeEntry: 'Invalid stake entry' - * - * @category Errors - * @category generated - */ -export class InvalidStakeEntryError extends Error { - readonly code: number = 0x1771 - readonly name: string = 'InvalidStakeEntry' - constructor() { - super('Invalid stake entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidStakeEntryError) - } - } -} - -createErrorFromCodeLookup.set(0x1771, () => new InvalidStakeEntryError()) -createErrorFromNameLookup.set( - 'InvalidStakeEntry', - () => new InvalidStakeEntryError() -) - -/** - * InvalidAuthority: 'Invalid stake pool authority' - * - * @category Errors - * @category generated - */ -export class InvalidAuthorityError extends Error { - readonly code: number = 0x1772 - readonly name: string = 'InvalidAuthority' - constructor() { - super('Invalid stake pool authority') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidAuthorityError) - } - } -} - -createErrorFromCodeLookup.set(0x1772, () => new InvalidAuthorityError()) -createErrorFromNameLookup.set( - 'InvalidAuthority', - () => new InvalidAuthorityError() -) - -/** - * InvalidEscrow: 'Mismatched user and escrow' - * - * @category Errors - * @category generated - */ -export class InvalidEscrowError extends Error { - readonly code: number = 0x1773 - readonly name: string = 'InvalidEscrow' - constructor() { - super('Mismatched user and escrow') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidEscrowError) - } - } -} - -createErrorFromCodeLookup.set(0x1773, () => new InvalidEscrowError()) -createErrorFromNameLookup.set('InvalidEscrow', () => new InvalidEscrowError()) - -/** - * InvalidUserStakeMintTokenAccount: 'Invalid user original mint token account' - * - * @category Errors - * @category generated - */ -export class InvalidUserStakeMintTokenAccountError extends Error { - readonly code: number = 0x177a - readonly name: string = 'InvalidUserStakeMintTokenAccount' - constructor() { - super('Invalid user original mint token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidUserStakeMintTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x177a, - () => new InvalidUserStakeMintTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidUserStakeMintTokenAccount', - () => new InvalidUserStakeMintTokenAccountError() -) - -/** - * InvalidLastStaker: 'Invalid last staker' - * - * @category Errors - * @category generated - */ -export class InvalidLastStakerError extends Error { - readonly code: number = 0x177b - readonly name: string = 'InvalidLastStaker' - constructor() { - super('Invalid last staker') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidLastStakerError) - } - } -} - -createErrorFromCodeLookup.set(0x177b, () => new InvalidLastStakerError()) -createErrorFromNameLookup.set( - 'InvalidLastStaker', - () => new InvalidLastStakerError() -) - -/** - * CannotUpdateUnstakedEntry: 'Cannot update unstaked entry' - * - * @category Errors - * @category generated - */ -export class CannotUpdateUnstakedEntryError extends Error { - readonly code: number = 0x177c - readonly name: string = 'CannotUpdateUnstakedEntry' - constructor() { - super('Cannot update unstaked entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotUpdateUnstakedEntryError) - } - } -} - -createErrorFromCodeLookup.set( - 0x177c, - () => new CannotUpdateUnstakedEntryError() -) -createErrorFromNameLookup.set( - 'CannotUpdateUnstakedEntry', - () => new CannotUpdateUnstakedEntryError() -) - -/** - * CannotCloseStakedEntry: 'Cannot close staked entry' - * - * @category Errors - * @category generated - */ -export class CannotCloseStakedEntryError extends Error { - readonly code: number = 0x177d - readonly name: string = 'CannotCloseStakedEntry' - constructor() { - super('Cannot close staked entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotCloseStakedEntryError) - } - } -} - -createErrorFromCodeLookup.set(0x177d, () => new CannotCloseStakedEntryError()) -createErrorFromNameLookup.set( - 'CannotCloseStakedEntry', - () => new CannotCloseStakedEntryError() -) - -/** - * CannotClosePoolWithStakedEntries: 'Cannot close staked entry' - * - * @category Errors - * @category generated - */ -export class CannotClosePoolWithStakedEntriesError extends Error { - readonly code: number = 0x177e - readonly name: string = 'CannotClosePoolWithStakedEntries' - constructor() { - super('Cannot close staked entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotClosePoolWithStakedEntriesError) - } - } -} - -createErrorFromCodeLookup.set( - 0x177e, - () => new CannotClosePoolWithStakedEntriesError() -) -createErrorFromNameLookup.set( - 'CannotClosePoolWithStakedEntries', - () => new CannotClosePoolWithStakedEntriesError() -) - -/** - * InvalidMintMetadata: 'Invalid mint metadata' - * - * @category Errors - * @category generated - */ -export class InvalidMintMetadataError extends Error { - readonly code: number = 0x1784 - readonly name: string = 'InvalidMintMetadata' - constructor() { - super('Invalid mint metadata') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidMintMetadataError) - } - } -} - -createErrorFromCodeLookup.set(0x1784, () => new InvalidMintMetadataError()) -createErrorFromNameLookup.set( - 'InvalidMintMetadata', - () => new InvalidMintMetadataError() -) - -/** - * MintNotAllowedInPool: 'Mint not allowed in this pool' - * - * @category Errors - * @category generated - */ -export class MintNotAllowedInPoolError extends Error { - readonly code: number = 0x1785 - readonly name: string = 'MintNotAllowedInPool' - constructor() { - super('Mint not allowed in this pool') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MintNotAllowedInPoolError) - } - } -} - -createErrorFromCodeLookup.set(0x1785, () => new MintNotAllowedInPoolError()) -createErrorFromNameLookup.set( - 'MintNotAllowedInPool', - () => new MintNotAllowedInPoolError() -) - -/** - * InvalidStakeAuthorizationRecord: 'Invalid stake authorization provided' - * - * @category Errors - * @category generated - */ -export class InvalidStakeAuthorizationRecordError extends Error { - readonly code: number = 0x1786 - readonly name: string = 'InvalidStakeAuthorizationRecord' - constructor() { - super('Invalid stake authorization provided') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidStakeAuthorizationRecordError) - } - } -} - -createErrorFromCodeLookup.set( - 0x1786, - () => new InvalidStakeAuthorizationRecordError() -) -createErrorFromNameLookup.set( - 'InvalidStakeAuthorizationRecord', - () => new InvalidStakeAuthorizationRecordError() -) - -/** - * InvalidMintMetadataOwner: 'Mint metadata is owned by the incorrect program' - * - * @category Errors - * @category generated - */ -export class InvalidMintMetadataOwnerError extends Error { - readonly code: number = 0x1787 - readonly name: string = 'InvalidMintMetadataOwner' - constructor() { - super('Mint metadata is owned by the incorrect program') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidMintMetadataOwnerError) - } - } -} - -createErrorFromCodeLookup.set(0x1787, () => new InvalidMintMetadataOwnerError()) -createErrorFromNameLookup.set( - 'InvalidMintMetadataOwner', - () => new InvalidMintMetadataOwnerError() -) - -/** - * InvalidPaymentMint: 'Invalid payment mint' - * - * @category Errors - * @category generated - */ -export class InvalidPaymentMintError extends Error { - readonly code: number = 0x178e - readonly name: string = 'InvalidPaymentMint' - constructor() { - super('Invalid payment mint') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPaymentMintError) - } - } -} - -createErrorFromCodeLookup.set(0x178e, () => new InvalidPaymentMintError()) -createErrorFromNameLookup.set( - 'InvalidPaymentMint', - () => new InvalidPaymentMintError() -) - -/** - * InvalidPaymentShares: 'Invalid payment shares' - * - * @category Errors - * @category generated - */ -export class InvalidPaymentSharesError extends Error { - readonly code: number = 0x178f - readonly name: string = 'InvalidPaymentShares' - constructor() { - super('Invalid payment shares') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPaymentSharesError) - } - } -} - -createErrorFromCodeLookup.set(0x178f, () => new InvalidPaymentSharesError()) -createErrorFromNameLookup.set( - 'InvalidPaymentShares', - () => new InvalidPaymentSharesError() -) - -/** - * InvalidPaymentShare: 'Invalid payment share' - * - * @category Errors - * @category generated - */ -export class InvalidPaymentShareError extends Error { - readonly code: number = 0x1790 - readonly name: string = 'InvalidPaymentShare' - constructor() { - super('Invalid payment share') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPaymentShareError) - } - } -} - -createErrorFromCodeLookup.set(0x1790, () => new InvalidPaymentShareError()) -createErrorFromNameLookup.set( - 'InvalidPaymentShare', - () => new InvalidPaymentShareError() -) - -/** - * InvalidPaymentTokenAccount: 'Invalid payment token account' - * - * @category Errors - * @category generated - */ -export class InvalidPaymentTokenAccountError extends Error { - readonly code: number = 0x1791 - readonly name: string = 'InvalidPaymentTokenAccount' - constructor() { - super('Invalid payment token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPaymentTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x1791, - () => new InvalidPaymentTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidPaymentTokenAccount', - () => new InvalidPaymentTokenAccountError() -) - -/** - * InvalidPayerTokenAccount: 'Invalid payer token account' - * - * @category Errors - * @category generated - */ -export class InvalidPayerTokenAccountError extends Error { - readonly code: number = 0x1792 - readonly name: string = 'InvalidPayerTokenAccount' - constructor() { - super('Invalid payer token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPayerTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set(0x1792, () => new InvalidPayerTokenAccountError()) -createErrorFromNameLookup.set( - 'InvalidPayerTokenAccount', - () => new InvalidPayerTokenAccountError() -) - -/** - * InvalidTransferProgram: 'Invalid transfer program' - * - * @category Errors - * @category generated - */ -export class InvalidTransferProgramError extends Error { - readonly code: number = 0x1793 - readonly name: string = 'InvalidTransferProgram' - constructor() { - super('Invalid transfer program') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidTransferProgramError) - } - } -} - -createErrorFromCodeLookup.set(0x1793, () => new InvalidTransferProgramError()) -createErrorFromNameLookup.set( - 'InvalidTransferProgram', - () => new InvalidTransferProgramError() -) - -/** - * CooldownSecondRemaining: 'Token still has some cooldown seconds remaining' - * - * @category Errors - * @category generated - */ -export class CooldownSecondRemainingError extends Error { - readonly code: number = 0x1798 - readonly name: string = 'CooldownSecondRemaining' - constructor() { - super('Token still has some cooldown seconds remaining') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CooldownSecondRemainingError) - } - } -} - -createErrorFromCodeLookup.set(0x1798, () => new CooldownSecondRemainingError()) -createErrorFromNameLookup.set( - 'CooldownSecondRemaining', - () => new CooldownSecondRemainingError() -) - -/** - * StakePoolHasEnded: 'Stake pool has ended' - * - * @category Errors - * @category generated - */ -export class StakePoolHasEndedError extends Error { - readonly code: number = 0x17a2 - readonly name: string = 'StakePoolHasEnded' - constructor() { - super('Stake pool has ended') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, StakePoolHasEndedError) - } - } -} - -createErrorFromCodeLookup.set(0x17a2, () => new StakePoolHasEndedError()) -createErrorFromNameLookup.set( - 'StakePoolHasEnded', - () => new StakePoolHasEndedError() -) - -/** - * MinStakeSecondsNotSatisfied: 'Minimum stake seconds not satisfied' - * - * @category Errors - * @category generated - */ -export class MinStakeSecondsNotSatisfiedError extends Error { - readonly code: number = 0x17a3 - readonly name: string = 'MinStakeSecondsNotSatisfied' - constructor() { - super('Minimum stake seconds not satisfied') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MinStakeSecondsNotSatisfiedError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17a3, - () => new MinStakeSecondsNotSatisfiedError() -) -createErrorFromNameLookup.set( - 'MinStakeSecondsNotSatisfied', - () => new MinStakeSecondsNotSatisfiedError() -) - -/** - * CannotBoostUnstakedToken: 'Cannot boost unstaked token' - * - * @category Errors - * @category generated - */ -export class CannotBoostUnstakedTokenError extends Error { - readonly code: number = 0x17ac - readonly name: string = 'CannotBoostUnstakedToken' - constructor() { - super('Cannot boost unstaked token') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotBoostUnstakedTokenError) - } - } -} - -createErrorFromCodeLookup.set(0x17ac, () => new CannotBoostUnstakedTokenError()) -createErrorFromNameLookup.set( - 'CannotBoostUnstakedToken', - () => new CannotBoostUnstakedTokenError() -) - -/** - * CannotBoostMoreThanCurrentTime: 'Cannot boost past current time less than start time' - * - * @category Errors - * @category generated - */ -export class CannotBoostMoreThanCurrentTimeError extends Error { - readonly code: number = 0x17ad - readonly name: string = 'CannotBoostMoreThanCurrentTime' - constructor() { - super('Cannot boost past current time less than start time') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotBoostMoreThanCurrentTimeError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17ad, - () => new CannotBoostMoreThanCurrentTimeError() -) -createErrorFromNameLookup.set( - 'CannotBoostMoreThanCurrentTime', - () => new CannotBoostMoreThanCurrentTimeError() -) - -/** - * InvalidBoostPayerTokenAccount: 'Invalid boost payer token account' - * - * @category Errors - * @category generated - */ -export class InvalidBoostPayerTokenAccountError extends Error { - readonly code: number = 0x17ae - readonly name: string = 'InvalidBoostPayerTokenAccount' - constructor() { - super('Invalid boost payer token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidBoostPayerTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17ae, - () => new InvalidBoostPayerTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidBoostPayerTokenAccount', - () => new InvalidBoostPayerTokenAccountError() -) - -/** - * InvalidBoostPaymentRecipientTokenAccount: 'Invalid boost payment recipient token account' - * - * @category Errors - * @category generated - */ -export class InvalidBoostPaymentRecipientTokenAccountError extends Error { - readonly code: number = 0x17af - readonly name: string = 'InvalidBoostPaymentRecipientTokenAccount' - constructor() { - super('Invalid boost payment recipient token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace( - this, - InvalidBoostPaymentRecipientTokenAccountError - ) - } - } -} - -createErrorFromCodeLookup.set( - 0x17af, - () => new InvalidBoostPaymentRecipientTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidBoostPaymentRecipientTokenAccount', - () => new InvalidBoostPaymentRecipientTokenAccountError() -) - -/** - * InvalidPaymentManager: 'Invalid payment manager' - * - * @category Errors - * @category generated - */ -export class InvalidPaymentManagerError extends Error { - readonly code: number = 0x17b0 - readonly name: string = 'InvalidPaymentManager' - constructor() { - super('Invalid payment manager') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPaymentManagerError) - } - } -} - -createErrorFromCodeLookup.set(0x17b0, () => new InvalidPaymentManagerError()) -createErrorFromNameLookup.set( - 'InvalidPaymentManager', - () => new InvalidPaymentManagerError() -) - -/** - * CannotBoostFungibleToken: 'Cannot boost a fungible token stake entry' - * - * @category Errors - * @category generated - */ -export class CannotBoostFungibleTokenError extends Error { - readonly code: number = 0x17b1 - readonly name: string = 'CannotBoostFungibleToken' - constructor() { - super('Cannot boost a fungible token stake entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, CannotBoostFungibleTokenError) - } - } -} - -createErrorFromCodeLookup.set(0x17b1, () => new CannotBoostFungibleTokenError()) -createErrorFromNameLookup.set( - 'CannotBoostFungibleToken', - () => new CannotBoostFungibleTokenError() -) - -/** - * MaxNumberOfReceiptsExceeded: 'Max number of receipts exceeded' - * - * @category Errors - * @category generated - */ -export class MaxNumberOfReceiptsExceededError extends Error { - readonly code: number = 0x17b6 - readonly name: string = 'MaxNumberOfReceiptsExceeded' - constructor() { - super('Max number of receipts exceeded') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, MaxNumberOfReceiptsExceededError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17b6, - () => new MaxNumberOfReceiptsExceededError() -) -createErrorFromNameLookup.set( - 'MaxNumberOfReceiptsExceeded', - () => new MaxNumberOfReceiptsExceededError() -) - -/** - * InvalidClaimer: 'Invalid claimer' - * - * @category Errors - * @category generated - */ -export class InvalidClaimerError extends Error { - readonly code: number = 0x17b7 - readonly name: string = 'InvalidClaimer' - constructor() { - super('Invalid claimer') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidClaimerError) - } - } -} - -createErrorFromCodeLookup.set(0x17b7, () => new InvalidClaimerError()) -createErrorFromNameLookup.set('InvalidClaimer', () => new InvalidClaimerError()) - -/** - * RewardSecondsNotSatisfied: 'Reward seconds not satisifed' - * - * @category Errors - * @category generated - */ -export class RewardSecondsNotSatisfiedError extends Error { - readonly code: number = 0x17b8 - readonly name: string = 'RewardSecondsNotSatisfied' - constructor() { - super('Reward seconds not satisifed') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, RewardSecondsNotSatisfiedError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17b8, - () => new RewardSecondsNotSatisfiedError() -) -createErrorFromNameLookup.set( - 'RewardSecondsNotSatisfied', - () => new RewardSecondsNotSatisfiedError() -) - -/** - * InvalidPayerTokenAcount: 'Invalid payer token account' - * - * @category Errors - * @category generated - */ -export class InvalidPayerTokenAcountError extends Error { - readonly code: number = 0x17b9 - readonly name: string = 'InvalidPayerTokenAcount' - constructor() { - super('Invalid payer token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPayerTokenAcountError) - } - } -} - -createErrorFromCodeLookup.set(0x17b9, () => new InvalidPayerTokenAcountError()) -createErrorFromNameLookup.set( - 'InvalidPayerTokenAcount', - () => new InvalidPayerTokenAcountError() -) - -/** - * InvalidMaxClaimedReceipts: 'Invalid max claimed receipts' - * - * @category Errors - * @category generated - */ -export class InvalidMaxClaimedReceiptsError extends Error { - readonly code: number = 0x17ba - readonly name: string = 'InvalidMaxClaimedReceipts' - constructor() { - super('Invalid max claimed receipts') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidMaxClaimedReceiptsError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17ba, - () => new InvalidMaxClaimedReceiptsError() -) -createErrorFromNameLookup.set( - 'InvalidMaxClaimedReceipts', - () => new InvalidMaxClaimedReceiptsError() -) - -/** - * InvalidRewardReceipt: 'Invalid reward receipt' - * - * @category Errors - * @category generated - */ -export class InvalidRewardReceiptError extends Error { - readonly code: number = 0x17bb - readonly name: string = 'InvalidRewardReceipt' - constructor() { - super('Invalid reward receipt') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardReceiptError) - } - } -} - -createErrorFromCodeLookup.set(0x17bb, () => new InvalidRewardReceiptError()) -createErrorFromNameLookup.set( - 'InvalidRewardReceipt', - () => new InvalidRewardReceiptError() -) - -/** - * InvalidReceiptEntry: 'Invalid receipt entry' - * - * @category Errors - * @category generated - */ -export class InvalidReceiptEntryError extends Error { - readonly code: number = 0x17bc - readonly name: string = 'InvalidReceiptEntry' - constructor() { - super('Invalid receipt entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidReceiptEntryError) - } - } -} - -createErrorFromCodeLookup.set(0x17bc, () => new InvalidReceiptEntryError()) -createErrorFromNameLookup.set( - 'InvalidReceiptEntry', - () => new InvalidReceiptEntryError() -) - -/** - * InsufficientAvailableStakeSeconds: 'Insufficient available stake seconds to use' - * - * @category Errors - * @category generated - */ -export class InsufficientAvailableStakeSecondsError extends Error { - readonly code: number = 0x17bd - readonly name: string = 'InsufficientAvailableStakeSeconds' - constructor() { - super('Insufficient available stake seconds to use') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InsufficientAvailableStakeSecondsError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17bd, - () => new InsufficientAvailableStakeSecondsError() -) -createErrorFromNameLookup.set( - 'InsufficientAvailableStakeSeconds', - () => new InsufficientAvailableStakeSecondsError() -) - -/** - * InvalidReceiptManager: 'Invalid receipt manager' - * - * @category Errors - * @category generated - */ -export class InvalidReceiptManagerError extends Error { - readonly code: number = 0x17be - readonly name: string = 'InvalidReceiptManager' - constructor() { - super('Invalid receipt manager') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidReceiptManagerError) - } - } -} - -createErrorFromCodeLookup.set(0x17be, () => new InvalidReceiptManagerError()) -createErrorFromNameLookup.set( - 'InvalidReceiptManager', - () => new InvalidReceiptManagerError() -) - -/** - * RewardReceiptIsNotAllowed: 'Reward receipt is not allowed' - * - * @category Errors - * @category generated - */ -export class RewardReceiptIsNotAllowedError extends Error { - readonly code: number = 0x17bf - readonly name: string = 'RewardReceiptIsNotAllowed' - constructor() { - super('Reward receipt is not allowed') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, RewardReceiptIsNotAllowedError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17bf, - () => new RewardReceiptIsNotAllowedError() -) -createErrorFromNameLookup.set( - 'RewardReceiptIsNotAllowed', - () => new RewardReceiptIsNotAllowedError() -) - -/** - * RewardReceiptAlreadyClaimed: 'Reward receipt already claimed' - * - * @category Errors - * @category generated - */ -export class RewardReceiptAlreadyClaimedError extends Error { - readonly code: number = 0x17c0 - readonly name: string = 'RewardReceiptAlreadyClaimed' - constructor() { - super('Reward receipt already claimed') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, RewardReceiptAlreadyClaimedError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17c0, - () => new RewardReceiptAlreadyClaimedError() -) -createErrorFromNameLookup.set( - 'RewardReceiptAlreadyClaimed', - () => new RewardReceiptAlreadyClaimedError() -) - -/** - * InvalidTokenAccount: 'Invalid token account' - * - * @category Errors - * @category generated - */ -export class InvalidTokenAccountError extends Error { - readonly code: number = 0x17ca - readonly name: string = 'InvalidTokenAccount' - constructor() { - super('Invalid token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set(0x17ca, () => new InvalidTokenAccountError()) -createErrorFromNameLookup.set( - 'InvalidTokenAccount', - () => new InvalidTokenAccountError() -) - -/** - * InvalidRewardMint: 'Invalid reward mint' - * - * @category Errors - * @category generated - */ -export class InvalidRewardMintError extends Error { - readonly code: number = 0x17cb - readonly name: string = 'InvalidRewardMint' - constructor() { - super('Invalid reward mint') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardMintError) - } - } -} - -createErrorFromCodeLookup.set(0x17cb, () => new InvalidRewardMintError()) -createErrorFromNameLookup.set( - 'InvalidRewardMint', - () => new InvalidRewardMintError() -) - -/** - * InvalidUserRewardMintTokenAccount: 'Invalid user reward mint token account' - * - * @category Errors - * @category generated - */ -export class InvalidUserRewardMintTokenAccountError extends Error { - readonly code: number = 0x17cc - readonly name: string = 'InvalidUserRewardMintTokenAccount' - constructor() { - super('Invalid user reward mint token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidUserRewardMintTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17cc, - () => new InvalidUserRewardMintTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidUserRewardMintTokenAccount', - () => new InvalidUserRewardMintTokenAccountError() -) - -/** - * InvalidRewardDistributor: 'Invalid reward distributor' - * - * @category Errors - * @category generated - */ -export class InvalidRewardDistributorError extends Error { - readonly code: number = 0x17cd - readonly name: string = 'InvalidRewardDistributor' - constructor() { - super('Invalid reward distributor') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardDistributorError) - } - } -} - -createErrorFromCodeLookup.set(0x17cd, () => new InvalidRewardDistributorError()) -createErrorFromNameLookup.set( - 'InvalidRewardDistributor', - () => new InvalidRewardDistributorError() -) - -/** - * InvalidRewardDistributorAuthority: 'Invalid reward distributor authority' - * - * @category Errors - * @category generated - */ -export class InvalidRewardDistributorAuthorityError extends Error { - readonly code: number = 0x17ce - readonly name: string = 'InvalidRewardDistributorAuthority' - constructor() { - super('Invalid reward distributor authority') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardDistributorAuthorityError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17ce, - () => new InvalidRewardDistributorAuthorityError() -) -createErrorFromNameLookup.set( - 'InvalidRewardDistributorAuthority', - () => new InvalidRewardDistributorAuthorityError() -) - -/** - * InvalidRewardDistributorKind: 'Invalid reward distributor kind' - * - * @category Errors - * @category generated - */ -export class InvalidRewardDistributorKindError extends Error { - readonly code: number = 0x17cf - readonly name: string = 'InvalidRewardDistributorKind' - constructor() { - super('Invalid reward distributor kind') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardDistributorKindError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17cf, - () => new InvalidRewardDistributorKindError() -) -createErrorFromNameLookup.set( - 'InvalidRewardDistributorKind', - () => new InvalidRewardDistributorKindError() -) - -/** - * SupplyRequired: 'Initial supply required for kind treasury' - * - * @category Errors - * @category generated - */ -export class SupplyRequiredError extends Error { - readonly code: number = 0x17d0 - readonly name: string = 'SupplyRequired' - constructor() { - super('Initial supply required for kind treasury') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, SupplyRequiredError) - } - } -} - -createErrorFromCodeLookup.set(0x17d0, () => new SupplyRequiredError()) -createErrorFromNameLookup.set('SupplyRequired', () => new SupplyRequiredError()) - -/** - * InvalidPoolDistributor: 'Invalid distributor for pool' - * - * @category Errors - * @category generated - */ -export class InvalidPoolDistributorError extends Error { - readonly code: number = 0x17d1 - readonly name: string = 'InvalidPoolDistributor' - constructor() { - super('Invalid distributor for pool') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidPoolDistributorError) - } - } -} - -createErrorFromCodeLookup.set(0x17d1, () => new InvalidPoolDistributorError()) -createErrorFromNameLookup.set( - 'InvalidPoolDistributor', - () => new InvalidPoolDistributorError() -) - -/** - * DistributorNotClosed: 'Distributor is already open' - * - * @category Errors - * @category generated - */ -export class DistributorNotClosedError extends Error { - readonly code: number = 0x17d2 - readonly name: string = 'DistributorNotClosed' - constructor() { - super('Distributor is already open') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DistributorNotClosedError) - } - } -} - -createErrorFromCodeLookup.set(0x17d2, () => new DistributorNotClosedError()) -createErrorFromNameLookup.set( - 'DistributorNotClosed', - () => new DistributorNotClosedError() -) - -/** - * DistributorAlreadyClosed: 'Distributor is already closed' - * - * @category Errors - * @category generated - */ -export class DistributorAlreadyClosedError extends Error { - readonly code: number = 0x17d3 - readonly name: string = 'DistributorAlreadyClosed' - constructor() { - super('Distributor is already closed') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, DistributorAlreadyClosedError) - } - } -} - -createErrorFromCodeLookup.set(0x17d3, () => new DistributorAlreadyClosedError()) -createErrorFromNameLookup.set( - 'DistributorAlreadyClosed', - () => new DistributorAlreadyClosedError() -) - -/** - * InvalidRewardEntry: 'Invalid reward entry' - * - * @category Errors - * @category generated - */ -export class InvalidRewardEntryError extends Error { - readonly code: number = 0x17d4 - readonly name: string = 'InvalidRewardEntry' - constructor() { - super('Invalid reward entry') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardEntryError) - } - } -} - -createErrorFromCodeLookup.set(0x17d4, () => new InvalidRewardEntryError()) -createErrorFromNameLookup.set( - 'InvalidRewardEntry', - () => new InvalidRewardEntryError() -) - -/** - * InvalidRewardDistributorTokenAccount: 'Invalid reward distributor token account' - * - * @category Errors - * @category generated - */ -export class InvalidRewardDistributorTokenAccountError extends Error { - readonly code: number = 0x17d5 - readonly name: string = 'InvalidRewardDistributorTokenAccount' - constructor() { - super('Invalid reward distributor token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidRewardDistributorTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17d5, - () => new InvalidRewardDistributorTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidRewardDistributorTokenAccount', - () => new InvalidRewardDistributorTokenAccountError() -) - -/** - * InvalidAuthorityTokenAccount: 'Invalid authority token account' - * - * @category Errors - * @category generated - */ -export class InvalidAuthorityTokenAccountError extends Error { - readonly code: number = 0x17d6 - readonly name: string = 'InvalidAuthorityTokenAccount' - constructor() { - super('Invalid authority token account') - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, InvalidAuthorityTokenAccountError) - } - } -} - -createErrorFromCodeLookup.set( - 0x17d6, - () => new InvalidAuthorityTokenAccountError() -) -createErrorFromNameLookup.set( - 'InvalidAuthorityTokenAccount', - () => new InvalidAuthorityTokenAccountError() -) - -/** - * Attempts to resolve a custom program error from the provided error code. - * @category Errors - * @category generated - */ -export function errorFromCode(code: number): MaybeErrorWithCode { - const createError = createErrorFromCodeLookup.get(code) - return createError != null ? createError() : null -} - -/** - * Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'. - * @category Errors - * @category generated - */ -export function errorFromName(name: string): MaybeErrorWithCode { - const createError = createErrorFromNameLookup.get(name) - return createError != null ? createError() : null -} diff --git a/sdk/generated/index.ts b/sdk/generated/index.ts deleted file mode 100644 index a41dd60c..00000000 --- a/sdk/generated/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { PublicKey } from '@solana/web3.js' -export * from './accounts' -export * from './errors' -export * from './instructions' -export * from './types' - -/** - * Program address - * - * @category constants - * @category generated - */ -export const PROGRAM_ADDRESS = 'rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U' - -/** - * Program public key - * - * @category constants - * @category generated - */ -export const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS) diff --git a/sdk/generated/instructions/authorizeMint.ts b/sdk/generated/instructions/authorizeMint.ts deleted file mode 100644 index fd71bd1c..00000000 --- a/sdk/generated/instructions/authorizeMint.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import * as beet from '@metaplex-foundation/beet' - -/** - * @category Instructions - * @category AuthorizeMint - * @category generated - */ -export type AuthorizeMintInstructionArgs = { - mint: web3.PublicKey -} -/** - * @category Instructions - * @category AuthorizeMint - * @category generated - */ -export const authorizeMintStruct = new beet.BeetArgsStruct< - AuthorizeMintInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['mint', beetSolana.publicKey], - ], - 'AuthorizeMintInstructionArgs' -) -/** - * Accounts required by the _authorizeMint_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_] stakeAuthorizationRecord - * @property [_writable_, **signer**] authority - * @property [_writable_, **signer**] payer - * @category Instructions - * @category AuthorizeMint - * @category generated - */ -export type AuthorizeMintInstructionAccounts = { - stakePool: web3.PublicKey - stakeAuthorizationRecord: web3.PublicKey - authority: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const authorizeMintInstructionDiscriminator = [ - 9, 39, 140, 25, 174, 113, 9, 242, -] - -/** - * Creates a _AuthorizeMint_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category AuthorizeMint - * @category generated - */ -export function createAuthorizeMintInstruction( - accounts: AuthorizeMintInstructionAccounts, - args: AuthorizeMintInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = authorizeMintStruct.serialize({ - instructionDiscriminator: authorizeMintInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeAuthorizationRecord, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/boostStakeEntry.ts b/sdk/generated/instructions/boostStakeEntry.ts deleted file mode 100644 index 990f91ef..00000000 --- a/sdk/generated/instructions/boostStakeEntry.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - BoostStakeEntryIx, - boostStakeEntryIxBeet, -} from '../types/BoostStakeEntryIx' - -/** - * @category Instructions - * @category BoostStakeEntry - * @category generated - */ -export type BoostStakeEntryInstructionArgs = { - ix: BoostStakeEntryIx -} -/** - * @category Instructions - * @category BoostStakeEntry - * @category generated - */ -export const boostStakeEntryStruct = new beet.BeetArgsStruct< - BoostStakeEntryInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', boostStakeEntryIxBeet], - ], - 'BoostStakeEntryInstructionArgs' -) -/** - * Accounts required by the _boostStakeEntry_ instruction - * - * @property [_writable_] stakeBooster - * @property [_writable_] stakePool - * @property [_writable_] stakeEntry - * @property [] stakeMint - * @category Instructions - * @category BoostStakeEntry - * @category generated - */ -export type BoostStakeEntryInstructionAccounts = { - stakeBooster: web3.PublicKey - stakePool: web3.PublicKey - stakeEntry: web3.PublicKey - stakeMint: web3.PublicKey -} - -export const boostStakeEntryInstructionDiscriminator = [ - 0, 74, 151, 187, 119, 53, 170, 181, -] - -/** - * Creates a _BoostStakeEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category BoostStakeEntry - * @category generated - */ -export function createBoostStakeEntryInstruction( - accounts: BoostStakeEntryInstructionAccounts, - args: BoostStakeEntryInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = boostStakeEntryStruct.serialize({ - instructionDiscriminator: boostStakeEntryInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeBooster, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeMint, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/claimRewardReceipt.ts b/sdk/generated/instructions/claimRewardReceipt.ts deleted file mode 100644 index a1dc802b..00000000 --- a/sdk/generated/instructions/claimRewardReceipt.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category ClaimRewardReceipt - * @category generated - */ -export const claimRewardReceiptStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'ClaimRewardReceiptInstructionArgs' -) -/** - * Accounts required by the _claimRewardReceipt_ instruction - * - * @property [_writable_] rewardReceipt - * @property [_writable_] receiptManager - * @property [_writable_] stakeEntry - * @property [_writable_, **signer**] payer - * @property [_writable_, **signer**] claimer - * @category Instructions - * @category ClaimRewardReceipt - * @category generated - */ -export type ClaimRewardReceiptInstructionAccounts = { - rewardReceipt: web3.PublicKey - receiptManager: web3.PublicKey - stakeEntry: web3.PublicKey - payer: web3.PublicKey - claimer: web3.PublicKey -} - -export const claimRewardReceiptInstructionDiscriminator = [ - 19, 193, 200, 24, 22, 76, 23, 220, -] - -/** - * Creates a _ClaimRewardReceipt_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category ClaimRewardReceipt - * @category generated - */ -export function createClaimRewardReceiptInstruction( - accounts: ClaimRewardReceiptInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = claimRewardReceiptStruct.serialize({ - instructionDiscriminator: claimRewardReceiptInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardReceipt, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.receiptManager, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.claimer, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/claimRewards.ts b/sdk/generated/instructions/claimRewards.ts deleted file mode 100644 index 042faaad..00000000 --- a/sdk/generated/instructions/claimRewards.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category ClaimRewards - * @category generated - */ -export const claimRewardsStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'ClaimRewardsInstructionArgs' -) -/** - * Accounts required by the _claimRewards_ instruction - * - * @property [_writable_] rewardEntry - * @property [_writable_] rewardDistributor - * @property [] stakeEntry - * @property [] stakePool - * @property [_writable_] rewardMint - * @property [_writable_] userRewardMintTokenAccount - * @property [_writable_] rewardDistributorTokenAccount - * @property [_writable_, **signer**] user - * @category Instructions - * @category ClaimRewards - * @category generated - */ -export type ClaimRewardsInstructionAccounts = { - rewardEntry: web3.PublicKey - rewardDistributor: web3.PublicKey - stakeEntry: web3.PublicKey - stakePool: web3.PublicKey - rewardMint: web3.PublicKey - userRewardMintTokenAccount: web3.PublicKey - rewardDistributorTokenAccount: web3.PublicKey - user: web3.PublicKey - tokenProgram?: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const claimRewardsInstructionDiscriminator = [ - 4, 144, 132, 71, 116, 23, 151, 80, -] - -/** - * Creates a _ClaimRewards_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category ClaimRewards - * @category generated - */ -export function createClaimRewardsInstruction( - accounts: ClaimRewardsInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = claimRewardsStruct.serialize({ - instructionDiscriminator: claimRewardsInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.rewardDistributor, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardMint, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.userRewardMintTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.rewardDistributorTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.user, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closePaymentInfo.ts b/sdk/generated/instructions/closePaymentInfo.ts deleted file mode 100644 index bad28ce8..00000000 --- a/sdk/generated/instructions/closePaymentInfo.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category ClosePaymentInfo - * @category generated - */ -export const closePaymentInfoStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'ClosePaymentInfoInstructionArgs' -) -/** - * Accounts required by the _closePaymentInfo_ instruction - * - * @property [_writable_] paymentInfo - * @property [_writable_, **signer**] authority - * @category Instructions - * @category ClosePaymentInfo - * @category generated - */ -export type ClosePaymentInfoInstructionAccounts = { - paymentInfo: web3.PublicKey - authority: web3.PublicKey -} - -export const closePaymentInfoInstructionDiscriminator = [ - 238, 195, 0, 251, 44, 52, 217, 171, -] - -/** - * Creates a _ClosePaymentInfo_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category ClosePaymentInfo - * @category generated - */ -export function createClosePaymentInfoInstruction( - accounts: ClosePaymentInfoInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closePaymentInfoStruct.serialize({ - instructionDiscriminator: closePaymentInfoInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.paymentInfo, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeReceiptManager.ts b/sdk/generated/instructions/closeReceiptManager.ts deleted file mode 100644 index 441d091e..00000000 --- a/sdk/generated/instructions/closeReceiptManager.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseReceiptManager - * @category generated - */ -export const closeReceiptManagerStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseReceiptManagerInstructionArgs' -) -/** - * Accounts required by the _closeReceiptManager_ instruction - * - * @property [_writable_] receiptManager - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseReceiptManager - * @category generated - */ -export type CloseReceiptManagerInstructionAccounts = { - receiptManager: web3.PublicKey - authority: web3.PublicKey -} - -export const closeReceiptManagerInstructionDiscriminator = [ - 197, 111, 141, 82, 48, 138, 70, 79, -] - -/** - * Creates a _CloseReceiptManager_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseReceiptManager - * @category generated - */ -export function createCloseReceiptManagerInstruction( - accounts: CloseReceiptManagerInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeReceiptManagerStruct.serialize({ - instructionDiscriminator: closeReceiptManagerInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.receiptManager, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeRewardDistributor.ts b/sdk/generated/instructions/closeRewardDistributor.ts deleted file mode 100644 index 7d56cb04..00000000 --- a/sdk/generated/instructions/closeRewardDistributor.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseRewardDistributor - * @category generated - */ -export const closeRewardDistributorStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseRewardDistributorInstructionArgs' -) -/** - * Accounts required by the _closeRewardDistributor_ instruction - * - * @property [_writable_] rewardDistributor - * @property [] stakePool - * @property [_writable_] rewardMint - * @property [_writable_] rewardDistributorTokenAccount - * @property [_writable_] authorityTokenAccount - * @property [_writable_, **signer**] signer - * @category Instructions - * @category CloseRewardDistributor - * @category generated - */ -export type CloseRewardDistributorInstructionAccounts = { - rewardDistributor: web3.PublicKey - stakePool: web3.PublicKey - rewardMint: web3.PublicKey - rewardDistributorTokenAccount: web3.PublicKey - authorityTokenAccount: web3.PublicKey - signer: web3.PublicKey - tokenProgram?: web3.PublicKey -} - -export const closeRewardDistributorInstructionDiscriminator = [ - 15, 243, 181, 170, 59, 223, 157, 82, -] - -/** - * Creates a _CloseRewardDistributor_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseRewardDistributor - * @category generated - */ -export function createCloseRewardDistributorInstruction( - accounts: CloseRewardDistributorInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeRewardDistributorStruct.serialize({ - instructionDiscriminator: closeRewardDistributorInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardDistributor, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardMint, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.rewardDistributorTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authorityTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.signer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeRewardEntry.ts b/sdk/generated/instructions/closeRewardEntry.ts deleted file mode 100644 index 5a7833a8..00000000 --- a/sdk/generated/instructions/closeRewardEntry.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseRewardEntry - * @category generated - */ -export const closeRewardEntryStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseRewardEntryInstructionArgs' -) -/** - * Accounts required by the _closeRewardEntry_ instruction - * - * @property [] rewardDistributor - * @property [_writable_] rewardEntry - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseRewardEntry - * @category generated - */ -export type CloseRewardEntryInstructionAccounts = { - rewardDistributor: web3.PublicKey - rewardEntry: web3.PublicKey - authority: web3.PublicKey -} - -export const closeRewardEntryInstructionDiscriminator = [ - 227, 139, 250, 154, 59, 134, 97, 123, -] - -/** - * Creates a _CloseRewardEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseRewardEntry - * @category generated - */ -export function createCloseRewardEntryInstruction( - accounts: CloseRewardEntryInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeRewardEntryStruct.serialize({ - instructionDiscriminator: closeRewardEntryInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardDistributor, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeRewardReceipt.ts b/sdk/generated/instructions/closeRewardReceipt.ts deleted file mode 100644 index dc8cb3da..00000000 --- a/sdk/generated/instructions/closeRewardReceipt.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseRewardReceipt - * @category generated - */ -export const closeRewardReceiptStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseRewardReceiptInstructionArgs' -) -/** - * Accounts required by the _closeRewardReceipt_ instruction - * - * @property [_writable_] rewardReceipt - * @property [] receiptManager - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseRewardReceipt - * @category generated - */ -export type CloseRewardReceiptInstructionAccounts = { - rewardReceipt: web3.PublicKey - receiptManager: web3.PublicKey - authority: web3.PublicKey -} - -export const closeRewardReceiptInstructionDiscriminator = [ - 32, 71, 112, 123, 26, 145, 174, 48, -] - -/** - * Creates a _CloseRewardReceipt_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseRewardReceipt - * @category generated - */ -export function createCloseRewardReceiptInstruction( - accounts: CloseRewardReceiptInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeRewardReceiptStruct.serialize({ - instructionDiscriminator: closeRewardReceiptInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardReceipt, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.receiptManager, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeStakeBooster.ts b/sdk/generated/instructions/closeStakeBooster.ts deleted file mode 100644 index bd70c021..00000000 --- a/sdk/generated/instructions/closeStakeBooster.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseStakeBooster - * @category generated - */ -export const closeStakeBoosterStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseStakeBoosterInstructionArgs' -) -/** - * Accounts required by the _closeStakeBooster_ instruction - * - * @property [_writable_] stakeBooster - * @property [_writable_] stakePool - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseStakeBooster - * @category generated - */ -export type CloseStakeBoosterInstructionAccounts = { - stakeBooster: web3.PublicKey - stakePool: web3.PublicKey - authority: web3.PublicKey -} - -export const closeStakeBoosterInstructionDiscriminator = [ - 12, 141, 144, 159, 75, 219, 34, 169, -] - -/** - * Creates a _CloseStakeBooster_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseStakeBooster - * @category generated - */ -export function createCloseStakeBoosterInstruction( - accounts: CloseStakeBoosterInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeStakeBoosterStruct.serialize({ - instructionDiscriminator: closeStakeBoosterInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeBooster, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeStakeEntry.ts b/sdk/generated/instructions/closeStakeEntry.ts deleted file mode 100644 index fd341991..00000000 --- a/sdk/generated/instructions/closeStakeEntry.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseStakeEntry - * @category generated - */ -export const closeStakeEntryStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseStakeEntryInstructionArgs' -) -/** - * Accounts required by the _closeStakeEntry_ instruction - * - * @property [] stakePool - * @property [_writable_] stakeEntry - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseStakeEntry - * @category generated - */ -export type CloseStakeEntryInstructionAccounts = { - stakePool: web3.PublicKey - stakeEntry: web3.PublicKey - authority: web3.PublicKey -} - -export const closeStakeEntryInstructionDiscriminator = [ - 48, 103, 249, 196, 41, 126, 174, 32, -] - -/** - * Creates a _CloseStakeEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseStakeEntry - * @category generated - */ -export function createCloseStakeEntryInstruction( - accounts: CloseStakeEntryInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeStakeEntryStruct.serialize({ - instructionDiscriminator: closeStakeEntryInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/closeStakePool.ts b/sdk/generated/instructions/closeStakePool.ts deleted file mode 100644 index feec988b..00000000 --- a/sdk/generated/instructions/closeStakePool.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category CloseStakePool - * @category generated - */ -export const closeStakePoolStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'CloseStakePoolInstructionArgs' -) -/** - * Accounts required by the _closeStakePool_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_, **signer**] authority - * @category Instructions - * @category CloseStakePool - * @category generated - */ -export type CloseStakePoolInstructionAccounts = { - stakePool: web3.PublicKey - authority: web3.PublicKey -} - -export const closeStakePoolInstructionDiscriminator = [ - 247, 11, 104, 96, 182, 127, 246, 3, -] - -/** - * Creates a _CloseStakePool_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category CloseStakePool - * @category generated - */ -export function createCloseStakePoolInstruction( - accounts: CloseStakePoolInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = closeStakePoolStruct.serialize({ - instructionDiscriminator: closeStakePoolInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/deauthorizeMint.ts b/sdk/generated/instructions/deauthorizeMint.ts deleted file mode 100644 index f4909d7a..00000000 --- a/sdk/generated/instructions/deauthorizeMint.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category DeauthorizeMint - * @category generated - */ -export const deauthorizeMintStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'DeauthorizeMintInstructionArgs' -) -/** - * Accounts required by the _deauthorizeMint_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_] stakeAuthorizationRecord - * @property [_writable_, **signer**] authority - * @category Instructions - * @category DeauthorizeMint - * @category generated - */ -export type DeauthorizeMintInstructionAccounts = { - stakePool: web3.PublicKey - stakeAuthorizationRecord: web3.PublicKey - authority: web3.PublicKey -} - -export const deauthorizeMintInstructionDiscriminator = [ - 89, 117, 35, 36, 164, 184, 56, 26, -] - -/** - * Creates a _DeauthorizeMint_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category DeauthorizeMint - * @category generated - */ -export function createDeauthorizeMintInstruction( - accounts: DeauthorizeMintInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = deauthorizeMintStruct.serialize({ - instructionDiscriminator: deauthorizeMintInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeAuthorizationRecord, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/index.ts b/sdk/generated/instructions/index.ts deleted file mode 100644 index 7ca91956..00000000 --- a/sdk/generated/instructions/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -export * from './authorizeMint' -export * from './boostStakeEntry' -export * from './claimRewardReceipt' -export * from './claimRewards' -export * from './closePaymentInfo' -export * from './closeReceiptManager' -export * from './closeRewardDistributor' -export * from './closeRewardEntry' -export * from './closeRewardReceipt' -export * from './closeStakeBooster' -export * from './closeStakeEntry' -export * from './closeStakePool' -export * from './deauthorizeMint' -export * from './initEntry' -export * from './initPaymentInfo' -export * from './initPool' -export * from './initReceiptManager' -export * from './initRewardDistributor' -export * from './initRewardEntry' -export * from './initRewardReceipt' -export * from './initStakeBooster' -export * from './resetStakeEntry' -export * from './setRewardReceiptAllowed' -export * from './stakeEdition' -export * from './unstakeEdition' -export * from './updatePaymentInfo' -export * from './updatePool' -export * from './updateReceiptManager' -export * from './updateRewardDistributor' -export * from './updateRewardEntry' -export * from './updateStakeBooster' -export * from './updateTotalStakeSeconds' diff --git a/sdk/generated/instructions/initEntry.ts b/sdk/generated/instructions/initEntry.ts deleted file mode 100644 index 229b9b79..00000000 --- a/sdk/generated/instructions/initEntry.ts +++ /dev/null @@ -1,119 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import * as beet from '@metaplex-foundation/beet' - -/** - * @category Instructions - * @category InitEntry - * @category generated - */ -export type InitEntryInstructionArgs = { - user: web3.PublicKey -} -/** - * @category Instructions - * @category InitEntry - * @category generated - */ -export const initEntryStruct = new beet.BeetArgsStruct< - InitEntryInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['user', beetSolana.publicKey], - ], - 'InitEntryInstructionArgs' -) -/** - * Accounts required by the _initEntry_ instruction - * - * @property [_writable_] stakeEntry - * @property [_writable_] stakePool - * @property [] stakeMint - * @property [] stakeMintMetadata - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitEntry - * @category generated - */ -export type InitEntryInstructionAccounts = { - stakeEntry: web3.PublicKey - stakePool: web3.PublicKey - stakeMint: web3.PublicKey - stakeMintMetadata: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initEntryInstructionDiscriminator = [ - 207, 80, 17, 185, 229, 148, 170, 183, -] - -/** - * Creates a _InitEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitEntry - * @category generated - */ -export function createInitEntryInstruction( - accounts: InitEntryInstructionAccounts, - args: InitEntryInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initEntryStruct.serialize({ - instructionDiscriminator: initEntryInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeMint, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeMintMetadata, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initPaymentInfo.ts b/sdk/generated/instructions/initPaymentInfo.ts deleted file mode 100644 index 1faea353..00000000 --- a/sdk/generated/instructions/initPaymentInfo.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - InitPaymentInfoIx, - initPaymentInfoIxBeet, -} from '../types/InitPaymentInfoIx' - -/** - * @category Instructions - * @category InitPaymentInfo - * @category generated - */ -export type InitPaymentInfoInstructionArgs = { - ix: InitPaymentInfoIx -} -/** - * @category Instructions - * @category InitPaymentInfo - * @category generated - */ -export const initPaymentInfoStruct = new beet.FixableBeetArgsStruct< - InitPaymentInfoInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', initPaymentInfoIxBeet], - ], - 'InitPaymentInfoInstructionArgs' -) -/** - * Accounts required by the _initPaymentInfo_ instruction - * - * @property [_writable_] paymentInfo - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitPaymentInfo - * @category generated - */ -export type InitPaymentInfoInstructionAccounts = { - paymentInfo: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initPaymentInfoInstructionDiscriminator = [ - 80, 104, 129, 74, 241, 76, 178, 21, -] - -/** - * Creates a _InitPaymentInfo_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitPaymentInfo - * @category generated - */ -export function createInitPaymentInfoInstruction( - accounts: InitPaymentInfoInstructionAccounts, - args: InitPaymentInfoInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initPaymentInfoStruct.serialize({ - instructionDiscriminator: initPaymentInfoInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.paymentInfo, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initPool.ts b/sdk/generated/instructions/initPool.ts deleted file mode 100644 index 06edd1e5..00000000 --- a/sdk/generated/instructions/initPool.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { InitPoolIx, initPoolIxBeet } from '../types/InitPoolIx' - -/** - * @category Instructions - * @category InitPool - * @category generated - */ -export type InitPoolInstructionArgs = { - ix: InitPoolIx -} -/** - * @category Instructions - * @category InitPool - * @category generated - */ -export const initPoolStruct = new beet.FixableBeetArgsStruct< - InitPoolInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', initPoolIxBeet], - ], - 'InitPoolInstructionArgs' -) -/** - * Accounts required by the _initPool_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitPool - * @category generated - */ -export type InitPoolInstructionAccounts = { - stakePool: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initPoolInstructionDiscriminator = [ - 116, 233, 199, 204, 115, 159, 171, 36, -] - -/** - * Creates a _InitPool_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitPool - * @category generated - */ -export function createInitPoolInstruction( - accounts: InitPoolInstructionAccounts, - args: InitPoolInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initPoolStruct.serialize({ - instructionDiscriminator: initPoolInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initReceiptManager.ts b/sdk/generated/instructions/initReceiptManager.ts deleted file mode 100644 index ee5c20d8..00000000 --- a/sdk/generated/instructions/initReceiptManager.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - InitReceiptManagerIx, - initReceiptManagerIxBeet, -} from '../types/InitReceiptManagerIx' - -/** - * @category Instructions - * @category InitReceiptManager - * @category generated - */ -export type InitReceiptManagerInstructionArgs = { - ix: InitReceiptManagerIx -} -/** - * @category Instructions - * @category InitReceiptManager - * @category generated - */ -export const initReceiptManagerStruct = new beet.FixableBeetArgsStruct< - InitReceiptManagerInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', initReceiptManagerIxBeet], - ], - 'InitReceiptManagerInstructionArgs' -) -/** - * Accounts required by the _initReceiptManager_ instruction - * - * @property [_writable_] receiptManager - * @property [] stakePool - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitReceiptManager - * @category generated - */ -export type InitReceiptManagerInstructionAccounts = { - receiptManager: web3.PublicKey - stakePool: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initReceiptManagerInstructionDiscriminator = [ - 119, 43, 115, 26, 239, 21, 10, 245, -] - -/** - * Creates a _InitReceiptManager_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitReceiptManager - * @category generated - */ -export function createInitReceiptManagerInstruction( - accounts: InitReceiptManagerInstructionAccounts, - args: InitReceiptManagerInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initReceiptManagerStruct.serialize({ - instructionDiscriminator: initReceiptManagerInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.receiptManager, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initRewardDistributor.ts b/sdk/generated/instructions/initRewardDistributor.ts deleted file mode 100644 index 49829018..00000000 --- a/sdk/generated/instructions/initRewardDistributor.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - InitRewardDistributorIx, - initRewardDistributorIxBeet, -} from '../types/InitRewardDistributorIx' - -/** - * @category Instructions - * @category InitRewardDistributor - * @category generated - */ -export type InitRewardDistributorInstructionArgs = { - ix: InitRewardDistributorIx -} -/** - * @category Instructions - * @category InitRewardDistributor - * @category generated - */ -export const initRewardDistributorStruct = new beet.FixableBeetArgsStruct< - InitRewardDistributorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', initRewardDistributorIxBeet], - ], - 'InitRewardDistributorInstructionArgs' -) -/** - * Accounts required by the _initRewardDistributor_ instruction - * - * @property [_writable_] rewardDistributor - * @property [] stakePool - * @property [_writable_] rewardMint - * @property [_writable_, **signer**] authority - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitRewardDistributor - * @category generated - */ -export type InitRewardDistributorInstructionAccounts = { - rewardDistributor: web3.PublicKey - stakePool: web3.PublicKey - rewardMint: web3.PublicKey - authority: web3.PublicKey - payer: web3.PublicKey - tokenProgram?: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initRewardDistributorInstructionDiscriminator = [ - 195, 125, 227, 27, 152, 100, 218, 38, -] - -/** - * Creates a _InitRewardDistributor_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitRewardDistributor - * @category generated - */ -export function createInitRewardDistributorInstruction( - accounts: InitRewardDistributorInstructionAccounts, - args: InitRewardDistributorInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initRewardDistributorStruct.serialize({ - instructionDiscriminator: initRewardDistributorInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardDistributor, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardMint, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initRewardEntry.ts b/sdk/generated/instructions/initRewardEntry.ts deleted file mode 100644 index 49df32d1..00000000 --- a/sdk/generated/instructions/initRewardEntry.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category InitRewardEntry - * @category generated - */ -export const initRewardEntryStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'InitRewardEntryInstructionArgs' -) -/** - * Accounts required by the _initRewardEntry_ instruction - * - * @property [_writable_] rewardEntry - * @property [] stakeEntry - * @property [_writable_] rewardDistributor - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitRewardEntry - * @category generated - */ -export type InitRewardEntryInstructionAccounts = { - rewardEntry: web3.PublicKey - stakeEntry: web3.PublicKey - rewardDistributor: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initRewardEntryInstructionDiscriminator = [ - 176, 135, 126, 179, 38, 97, 8, 115, -] - -/** - * Creates a _InitRewardEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category InitRewardEntry - * @category generated - */ -export function createInitRewardEntryInstruction( - accounts: InitRewardEntryInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initRewardEntryStruct.serialize({ - instructionDiscriminator: initRewardEntryInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardDistributor, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initRewardReceipt.ts b/sdk/generated/instructions/initRewardReceipt.ts deleted file mode 100644 index a82d9ad7..00000000 --- a/sdk/generated/instructions/initRewardReceipt.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category InitRewardReceipt - * @category generated - */ -export const initRewardReceiptStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'InitRewardReceiptInstructionArgs' -) -/** - * Accounts required by the _initRewardReceipt_ instruction - * - * @property [_writable_] rewardReceipt - * @property [] receiptManager - * @property [] stakeEntry - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitRewardReceipt - * @category generated - */ -export type InitRewardReceiptInstructionAccounts = { - rewardReceipt: web3.PublicKey - receiptManager: web3.PublicKey - stakeEntry: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initRewardReceiptInstructionDiscriminator = [ - 107, 148, 66, 165, 24, 246, 30, 120, -] - -/** - * Creates a _InitRewardReceipt_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category InitRewardReceipt - * @category generated - */ -export function createInitRewardReceiptInstruction( - accounts: InitRewardReceiptInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initRewardReceiptStruct.serialize({ - instructionDiscriminator: initRewardReceiptInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardReceipt, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.receiptManager, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/initStakeBooster.ts b/sdk/generated/instructions/initStakeBooster.ts deleted file mode 100644 index e53d2174..00000000 --- a/sdk/generated/instructions/initStakeBooster.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - InitStakeBoosterIx, - initStakeBoosterIxBeet, -} from '../types/InitStakeBoosterIx' - -/** - * @category Instructions - * @category InitStakeBooster - * @category generated - */ -export type InitStakeBoosterInstructionArgs = { - ix: InitStakeBoosterIx -} -/** - * @category Instructions - * @category InitStakeBooster - * @category generated - */ -export const initStakeBoosterStruct = new beet.FixableBeetArgsStruct< - InitStakeBoosterInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', initStakeBoosterIxBeet], - ], - 'InitStakeBoosterInstructionArgs' -) -/** - * Accounts required by the _initStakeBooster_ instruction - * - * @property [_writable_] stakeBooster - * @property [_writable_] stakePool - * @property [_writable_, **signer**] authority - * @property [_writable_, **signer**] payer - * @category Instructions - * @category InitStakeBooster - * @category generated - */ -export type InitStakeBoosterInstructionAccounts = { - stakeBooster: web3.PublicKey - stakePool: web3.PublicKey - authority: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const initStakeBoosterInstructionDiscriminator = [ - 251, 3, 136, 79, 211, 189, 184, 205, -] - -/** - * Creates a _InitStakeBooster_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category InitStakeBooster - * @category generated - */ -export function createInitStakeBoosterInstruction( - accounts: InitStakeBoosterInstructionAccounts, - args: InitStakeBoosterInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = initStakeBoosterStruct.serialize({ - instructionDiscriminator: initStakeBoosterInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeBooster, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/resetStakeEntry.ts b/sdk/generated/instructions/resetStakeEntry.ts deleted file mode 100644 index 95047abc..00000000 --- a/sdk/generated/instructions/resetStakeEntry.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category ResetStakeEntry - * @category generated - */ -export const resetStakeEntryStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'ResetStakeEntryInstructionArgs' -) -/** - * Accounts required by the _resetStakeEntry_ instruction - * - * @property [] stakePool - * @property [_writable_] stakeEntry - * @property [_writable_, **signer**] authority - * @category Instructions - * @category ResetStakeEntry - * @category generated - */ -export type ResetStakeEntryInstructionAccounts = { - stakePool: web3.PublicKey - stakeEntry: web3.PublicKey - authority: web3.PublicKey -} - -export const resetStakeEntryInstructionDiscriminator = [ - 189, 90, 39, 72, 82, 90, 236, 109, -] - -/** - * Creates a _ResetStakeEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category ResetStakeEntry - * @category generated - */ -export function createResetStakeEntryInstruction( - accounts: ResetStakeEntryInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = resetStakeEntryStruct.serialize({ - instructionDiscriminator: resetStakeEntryInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/setRewardReceiptAllowed.ts b/sdk/generated/instructions/setRewardReceiptAllowed.ts deleted file mode 100644 index 54c9d8aa..00000000 --- a/sdk/generated/instructions/setRewardReceiptAllowed.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category SetRewardReceiptAllowed - * @category generated - */ -export type SetRewardReceiptAllowedInstructionArgs = { - allowed: boolean -} -/** - * @category Instructions - * @category SetRewardReceiptAllowed - * @category generated - */ -export const setRewardReceiptAllowedStruct = new beet.BeetArgsStruct< - SetRewardReceiptAllowedInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['allowed', beet.bool], - ], - 'SetRewardReceiptAllowedInstructionArgs' -) -/** - * Accounts required by the _setRewardReceiptAllowed_ instruction - * - * @property [] receiptManager - * @property [_writable_] rewardReceipt - * @property [_writable_, **signer**] authority - * @category Instructions - * @category SetRewardReceiptAllowed - * @category generated - */ -export type SetRewardReceiptAllowedInstructionAccounts = { - receiptManager: web3.PublicKey - rewardReceipt: web3.PublicKey - authority: web3.PublicKey -} - -export const setRewardReceiptAllowedInstructionDiscriminator = [ - 249, 167, 0, 176, 129, 78, 102, 23, -] - -/** - * Creates a _SetRewardReceiptAllowed_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category SetRewardReceiptAllowed - * @category generated - */ -export function createSetRewardReceiptAllowedInstruction( - accounts: SetRewardReceiptAllowedInstructionAccounts, - args: SetRewardReceiptAllowedInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = setRewardReceiptAllowedStruct.serialize({ - instructionDiscriminator: setRewardReceiptAllowedInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.receiptManager, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.rewardReceipt, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/stakeEdition.ts b/sdk/generated/instructions/stakeEdition.ts deleted file mode 100644 index e60a36c4..00000000 --- a/sdk/generated/instructions/stakeEdition.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category StakeEdition - * @category generated - */ -export type StakeEditionInstructionArgs = { - amount: beet.bignum -} -/** - * @category Instructions - * @category StakeEdition - * @category generated - */ -export const stakeEditionStruct = new beet.BeetArgsStruct< - StakeEditionInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['amount', beet.u64], - ], - 'StakeEditionInstructionArgs' -) -/** - * Accounts required by the _stakeEdition_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_] stakeEntry - * @property [] stakeMint - * @property [] stakeMintEdition - * @property [] stakeMintMetadata - * @property [_writable_, **signer**] user - * @property [_writable_] userEscrow - * @property [_writable_] userStakeMintTokenAccount - * @property [] tokenMetadataProgram - * @category Instructions - * @category StakeEdition - * @category generated - */ -export type StakeEditionInstructionAccounts = { - stakePool: web3.PublicKey - stakeEntry: web3.PublicKey - stakeMint: web3.PublicKey - stakeMintEdition: web3.PublicKey - stakeMintMetadata: web3.PublicKey - user: web3.PublicKey - userEscrow: web3.PublicKey - userStakeMintTokenAccount: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - tokenProgram?: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const stakeEditionInstructionDiscriminator = [ - 90, 206, 63, 81, 224, 243, 64, 195, -] - -/** - * Creates a _StakeEdition_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category StakeEdition - * @category generated - */ -export function createStakeEditionInstruction( - accounts: StakeEditionInstructionAccounts, - args: StakeEditionInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = stakeEditionStruct.serialize({ - instructionDiscriminator: stakeEditionInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeMint, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeMintEdition, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeMintMetadata, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.user, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.userEscrow, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.userStakeMintTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.tokenMetadataProgram, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/unstakeEdition.ts b/sdk/generated/instructions/unstakeEdition.ts deleted file mode 100644 index bb7e8653..00000000 --- a/sdk/generated/instructions/unstakeEdition.ts +++ /dev/null @@ -1,129 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as splToken from '@solana/spl-token' -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category UnstakeEdition - * @category generated - */ -export const unstakeEditionStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'UnstakeEditionInstructionArgs' -) -/** - * Accounts required by the _unstakeEdition_ instruction - * - * @property [_writable_] stakePool - * @property [_writable_] stakeEntry - * @property [] stakeMint - * @property [] stakeMintEdition - * @property [_writable_, **signer**] user - * @property [_writable_] userEscrow - * @property [_writable_] userStakeMintTokenAccount - * @property [] tokenMetadataProgram - * @category Instructions - * @category UnstakeEdition - * @category generated - */ -export type UnstakeEditionInstructionAccounts = { - stakePool: web3.PublicKey - stakeEntry: web3.PublicKey - stakeMint: web3.PublicKey - stakeMintEdition: web3.PublicKey - user: web3.PublicKey - userEscrow: web3.PublicKey - userStakeMintTokenAccount: web3.PublicKey - tokenMetadataProgram: web3.PublicKey - tokenProgram?: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const unstakeEditionInstructionDiscriminator = [ - 14, 46, 5, 175, 171, 28, 33, 151, -] - -/** - * Creates a _UnstakeEdition_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category UnstakeEdition - * @category generated - */ -export function createUnstakeEditionInstruction( - accounts: UnstakeEditionInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = unstakeEditionStruct.serialize({ - instructionDiscriminator: unstakeEditionInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakeMint, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.stakeMintEdition, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.user, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.userEscrow, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.userStakeMintTokenAccount, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.tokenMetadataProgram, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.tokenProgram ?? splToken.TOKEN_PROGRAM_ID, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updatePaymentInfo.ts b/sdk/generated/instructions/updatePaymentInfo.ts deleted file mode 100644 index 660e9c53..00000000 --- a/sdk/generated/instructions/updatePaymentInfo.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - UpdatePaymentInfoIx, - updatePaymentInfoIxBeet, -} from '../types/UpdatePaymentInfoIx' - -/** - * @category Instructions - * @category UpdatePaymentInfo - * @category generated - */ -export type UpdatePaymentInfoInstructionArgs = { - ix: UpdatePaymentInfoIx -} -/** - * @category Instructions - * @category UpdatePaymentInfo - * @category generated - */ -export const updatePaymentInfoStruct = new beet.FixableBeetArgsStruct< - UpdatePaymentInfoInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updatePaymentInfoIxBeet], - ], - 'UpdatePaymentInfoInstructionArgs' -) -/** - * Accounts required by the _updatePaymentInfo_ instruction - * - * @property [_writable_] paymentInfo - * @property [**signer**] authority - * @property [_writable_, **signer**] payer - * @category Instructions - * @category UpdatePaymentInfo - * @category generated - */ -export type UpdatePaymentInfoInstructionAccounts = { - paymentInfo: web3.PublicKey - authority: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const updatePaymentInfoInstructionDiscriminator = [ - 124, 28, 198, 31, 188, 204, 187, 216, -] - -/** - * Creates a _UpdatePaymentInfo_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdatePaymentInfo - * @category generated - */ -export function createUpdatePaymentInfoInstruction( - accounts: UpdatePaymentInfoInstructionAccounts, - args: UpdatePaymentInfoInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updatePaymentInfoStruct.serialize({ - instructionDiscriminator: updatePaymentInfoInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.paymentInfo, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: false, - isSigner: true, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updatePool.ts b/sdk/generated/instructions/updatePool.ts deleted file mode 100644 index 23e4b356..00000000 --- a/sdk/generated/instructions/updatePool.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { UpdatePoolIx, updatePoolIxBeet } from '../types/UpdatePoolIx' - -/** - * @category Instructions - * @category UpdatePool - * @category generated - */ -export type UpdatePoolInstructionArgs = { - ix: UpdatePoolIx -} -/** - * @category Instructions - * @category UpdatePool - * @category generated - */ -export const updatePoolStruct = new beet.FixableBeetArgsStruct< - UpdatePoolInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updatePoolIxBeet], - ], - 'UpdatePoolInstructionArgs' -) -/** - * Accounts required by the _updatePool_ instruction - * - * @property [_writable_] stakePool - * @property [**signer**] authority - * @property [_writable_, **signer**] payer - * @category Instructions - * @category UpdatePool - * @category generated - */ -export type UpdatePoolInstructionAccounts = { - stakePool: web3.PublicKey - authority: web3.PublicKey - payer: web3.PublicKey - systemProgram?: web3.PublicKey -} - -export const updatePoolInstructionDiscriminator = [ - 239, 214, 170, 78, 36, 35, 30, 34, -] - -/** - * Creates a _UpdatePool_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdatePool - * @category generated - */ -export function createUpdatePoolInstruction( - accounts: UpdatePoolInstructionAccounts, - args: UpdatePoolInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updatePoolStruct.serialize({ - instructionDiscriminator: updatePoolInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: false, - isSigner: true, - }, - { - pubkey: accounts.payer, - isWritable: true, - isSigner: true, - }, - { - pubkey: accounts.systemProgram ?? web3.SystemProgram.programId, - isWritable: false, - isSigner: false, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updateReceiptManager.ts b/sdk/generated/instructions/updateReceiptManager.ts deleted file mode 100644 index 96cdebef..00000000 --- a/sdk/generated/instructions/updateReceiptManager.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - UpdateReceiptManagerIx, - updateReceiptManagerIxBeet, -} from '../types/UpdateReceiptManagerIx' - -/** - * @category Instructions - * @category UpdateReceiptManager - * @category generated - */ -export type UpdateReceiptManagerInstructionArgs = { - ix: UpdateReceiptManagerIx -} -/** - * @category Instructions - * @category UpdateReceiptManager - * @category generated - */ -export const updateReceiptManagerStruct = new beet.FixableBeetArgsStruct< - UpdateReceiptManagerInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updateReceiptManagerIxBeet], - ], - 'UpdateReceiptManagerInstructionArgs' -) -/** - * Accounts required by the _updateReceiptManager_ instruction - * - * @property [_writable_] receiptManager - * @property [**signer**] authority - * @category Instructions - * @category UpdateReceiptManager - * @category generated - */ -export type UpdateReceiptManagerInstructionAccounts = { - receiptManager: web3.PublicKey - authority: web3.PublicKey -} - -export const updateReceiptManagerInstructionDiscriminator = [ - 18, 45, 212, 2, 210, 18, 61, 93, -] - -/** - * Creates a _UpdateReceiptManager_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdateReceiptManager - * @category generated - */ -export function createUpdateReceiptManagerInstruction( - accounts: UpdateReceiptManagerInstructionAccounts, - args: UpdateReceiptManagerInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updateReceiptManagerStruct.serialize({ - instructionDiscriminator: updateReceiptManagerInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.receiptManager, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: false, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updateRewardDistributor.ts b/sdk/generated/instructions/updateRewardDistributor.ts deleted file mode 100644 index 3a83487f..00000000 --- a/sdk/generated/instructions/updateRewardDistributor.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - UpdateRewardDistributorIx, - updateRewardDistributorIxBeet, -} from '../types/UpdateRewardDistributorIx' - -/** - * @category Instructions - * @category UpdateRewardDistributor - * @category generated - */ -export type UpdateRewardDistributorInstructionArgs = { - ix: UpdateRewardDistributorIx -} -/** - * @category Instructions - * @category UpdateRewardDistributor - * @category generated - */ -export const updateRewardDistributorStruct = new beet.FixableBeetArgsStruct< - UpdateRewardDistributorInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updateRewardDistributorIxBeet], - ], - 'UpdateRewardDistributorInstructionArgs' -) -/** - * Accounts required by the _updateRewardDistributor_ instruction - * - * @property [_writable_] rewardDistributor - * @property [**signer**] authority - * @category Instructions - * @category UpdateRewardDistributor - * @category generated - */ -export type UpdateRewardDistributorInstructionAccounts = { - rewardDistributor: web3.PublicKey - authority: web3.PublicKey -} - -export const updateRewardDistributorInstructionDiscriminator = [ - 168, 16, 57, 210, 250, 214, 155, 146, -] - -/** - * Creates a _UpdateRewardDistributor_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdateRewardDistributor - * @category generated - */ -export function createUpdateRewardDistributorInstruction( - accounts: UpdateRewardDistributorInstructionAccounts, - args: UpdateRewardDistributorInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updateRewardDistributorStruct.serialize({ - instructionDiscriminator: updateRewardDistributorInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardDistributor, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: false, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updateRewardEntry.ts b/sdk/generated/instructions/updateRewardEntry.ts deleted file mode 100644 index 7cc24f82..00000000 --- a/sdk/generated/instructions/updateRewardEntry.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - UpdateRewardEntryIx, - updateRewardEntryIxBeet, -} from '../types/UpdateRewardEntryIx' - -/** - * @category Instructions - * @category UpdateRewardEntry - * @category generated - */ -export type UpdateRewardEntryInstructionArgs = { - ix: UpdateRewardEntryIx -} -/** - * @category Instructions - * @category UpdateRewardEntry - * @category generated - */ -export const updateRewardEntryStruct = new beet.BeetArgsStruct< - UpdateRewardEntryInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updateRewardEntryIxBeet], - ], - 'UpdateRewardEntryInstructionArgs' -) -/** - * Accounts required by the _updateRewardEntry_ instruction - * - * @property [_writable_] rewardEntry - * @property [] rewardDistributor - * @property [**signer**] authority - * @category Instructions - * @category UpdateRewardEntry - * @category generated - */ -export type UpdateRewardEntryInstructionAccounts = { - rewardEntry: web3.PublicKey - rewardDistributor: web3.PublicKey - authority: web3.PublicKey -} - -export const updateRewardEntryInstructionDiscriminator = [ - 102, 76, 212, 206, 101, 194, 250, 16, -] - -/** - * Creates a _UpdateRewardEntry_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdateRewardEntry - * @category generated - */ -export function createUpdateRewardEntryInstruction( - accounts: UpdateRewardEntryInstructionAccounts, - args: UpdateRewardEntryInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updateRewardEntryStruct.serialize({ - instructionDiscriminator: updateRewardEntryInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.rewardEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.rewardDistributor, - isWritable: false, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: false, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updateStakeBooster.ts b/sdk/generated/instructions/updateStakeBooster.ts deleted file mode 100644 index f464b43f..00000000 --- a/sdk/generated/instructions/updateStakeBooster.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import { - UpdateStakeBoosterIx, - updateStakeBoosterIxBeet, -} from '../types/UpdateStakeBoosterIx' - -/** - * @category Instructions - * @category UpdateStakeBooster - * @category generated - */ -export type UpdateStakeBoosterInstructionArgs = { - ix: UpdateStakeBoosterIx -} -/** - * @category Instructions - * @category UpdateStakeBooster - * @category generated - */ -export const updateStakeBoosterStruct = new beet.FixableBeetArgsStruct< - UpdateStakeBoosterInstructionArgs & { - instructionDiscriminator: number[] /* size: 8 */ - } ->( - [ - ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], - ['ix', updateStakeBoosterIxBeet], - ], - 'UpdateStakeBoosterInstructionArgs' -) -/** - * Accounts required by the _updateStakeBooster_ instruction - * - * @property [_writable_] stakeBooster - * @property [_writable_] stakePool - * @property [_writable_, **signer**] authority - * @category Instructions - * @category UpdateStakeBooster - * @category generated - */ -export type UpdateStakeBoosterInstructionAccounts = { - stakeBooster: web3.PublicKey - stakePool: web3.PublicKey - authority: web3.PublicKey -} - -export const updateStakeBoosterInstructionDiscriminator = [ - 248, 245, 42, 75, 39, 8, 117, 52, -] - -/** - * Creates a _UpdateStakeBooster_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @param args to provide as instruction data to the program - * - * @category Instructions - * @category UpdateStakeBooster - * @category generated - */ -export function createUpdateStakeBoosterInstruction( - accounts: UpdateStakeBoosterInstructionAccounts, - args: UpdateStakeBoosterInstructionArgs, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updateStakeBoosterStruct.serialize({ - instructionDiscriminator: updateStakeBoosterInstructionDiscriminator, - ...args, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeBooster, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.stakePool, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.authority, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/instructions/updateTotalStakeSeconds.ts b/sdk/generated/instructions/updateTotalStakeSeconds.ts deleted file mode 100644 index eaff661c..00000000 --- a/sdk/generated/instructions/updateTotalStakeSeconds.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' - -/** - * @category Instructions - * @category UpdateTotalStakeSeconds - * @category generated - */ -export const updateTotalStakeSecondsStruct = new beet.BeetArgsStruct<{ - instructionDiscriminator: number[] /* size: 8 */ -}>( - [['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], - 'UpdateTotalStakeSecondsInstructionArgs' -) -/** - * Accounts required by the _updateTotalStakeSeconds_ instruction - * - * @property [_writable_] stakeEntry - * @property [_writable_, **signer**] updater - * @category Instructions - * @category UpdateTotalStakeSeconds - * @category generated - */ -export type UpdateTotalStakeSecondsInstructionAccounts = { - stakeEntry: web3.PublicKey - updater: web3.PublicKey -} - -export const updateTotalStakeSecondsInstructionDiscriminator = [ - 156, 69, 149, 195, 171, 223, 177, 245, -] - -/** - * Creates a _UpdateTotalStakeSeconds_ instruction. - * - * @param accounts that will be accessed while the instruction is processed - * @category Instructions - * @category UpdateTotalStakeSeconds - * @category generated - */ -export function createUpdateTotalStakeSecondsInstruction( - accounts: UpdateTotalStakeSecondsInstructionAccounts, - programId = new web3.PublicKey('rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U') -) { - const [data] = updateTotalStakeSecondsStruct.serialize({ - instructionDiscriminator: updateTotalStakeSecondsInstructionDiscriminator, - }) - const keys: web3.AccountMeta[] = [ - { - pubkey: accounts.stakeEntry, - isWritable: true, - isSigner: false, - }, - { - pubkey: accounts.updater, - isWritable: true, - isSigner: true, - }, - ] - - const ix = new web3.TransactionInstruction({ - programId, - keys, - data, - }) - return ix -} diff --git a/sdk/generated/types/Action.ts b/sdk/generated/types/Action.ts deleted file mode 100644 index 1e146df8..00000000 --- a/sdk/generated/types/Action.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -/** - * @category enums - * @category generated - */ -export enum Action { - Stake, - Unstake, - ClaimRewards, - ClaimRewardReceipt, - BoostStakeEntry, -} - -/** - * @category userTypes - * @category generated - */ -export const actionBeet = beet.fixedScalarEnum(Action) as beet.FixedSizeBeet< - Action, - Action -> diff --git a/sdk/generated/types/BoostStakeEntryIx.ts b/sdk/generated/types/BoostStakeEntryIx.ts deleted file mode 100644 index 7c307d39..00000000 --- a/sdk/generated/types/BoostStakeEntryIx.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -export type BoostStakeEntryIx = { - secondsToBoost: beet.bignum -} - -/** - * @category userTypes - * @category generated - */ -export const boostStakeEntryIxBeet = new beet.BeetArgsStruct( - [['secondsToBoost', beet.u64]], - 'BoostStakeEntryIx' -) diff --git a/sdk/generated/types/InitPaymentInfoIx.ts b/sdk/generated/types/InitPaymentInfoIx.ts deleted file mode 100644 index dc1dc5a3..00000000 --- a/sdk/generated/types/InitPaymentInfoIx.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type InitPaymentInfoIx = { - authority: web3.PublicKey - identifier: string - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] -} - -/** - * @category userTypes - * @category generated - */ -export const initPaymentInfoIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['authority', beetSolana.publicKey], - ['identifier', beet.utf8String], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ], - 'InitPaymentInfoIx' - ) diff --git a/sdk/generated/types/InitPoolIx.ts b/sdk/generated/types/InitPoolIx.ts deleted file mode 100644 index 4b7bf8a2..00000000 --- a/sdk/generated/types/InitPoolIx.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -export type InitPoolIx = { - allowedCollections: web3.PublicKey[] - allowedCreators: web3.PublicKey[] - requiresAuthorization: boolean - authority: web3.PublicKey - resetOnUnstake: boolean - cooldownSeconds: beet.COption - minStakeSeconds: beet.COption - endDate: beet.COption - stakePaymentInfo: web3.PublicKey - unstakePaymentInfo: web3.PublicKey - identifier: string -} - -/** - * @category userTypes - * @category generated - */ -export const initPoolIxBeet = new beet.FixableBeetArgsStruct( - [ - ['allowedCollections', beet.array(beetSolana.publicKey)], - ['allowedCreators', beet.array(beetSolana.publicKey)], - ['requiresAuthorization', beet.bool], - ['authority', beetSolana.publicKey], - ['resetOnUnstake', beet.bool], - ['cooldownSeconds', beet.coption(beet.u32)], - ['minStakeSeconds', beet.coption(beet.u32)], - ['endDate', beet.coption(beet.i64)], - ['stakePaymentInfo', beetSolana.publicKey], - ['unstakePaymentInfo', beetSolana.publicKey], - ['identifier', beet.utf8String], - ], - 'InitPoolIx' -) diff --git a/sdk/generated/types/InitReceiptManagerIx.ts b/sdk/generated/types/InitReceiptManagerIx.ts deleted file mode 100644 index cd695d63..00000000 --- a/sdk/generated/types/InitReceiptManagerIx.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type InitReceiptManagerIx = { - name: string - authority: web3.PublicKey - requiredStakeSeconds: beet.bignum - stakeSecondsToUse: beet.bignum - paymentMint: web3.PublicKey - paymentAmount: beet.bignum - paymentShares: PaymentShare[] - requiresAuthorization: boolean - claimActionPaymentInfo: web3.PublicKey - maxClaimedReceipts: beet.COption -} - -/** - * @category userTypes - * @category generated - */ -export const initReceiptManagerIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['name', beet.utf8String], - ['authority', beetSolana.publicKey], - ['requiredStakeSeconds', beet.u128], - ['stakeSecondsToUse', beet.u128], - ['paymentMint', beetSolana.publicKey], - ['paymentAmount', beet.u64], - ['paymentShares', beet.array(paymentShareBeet)], - ['requiresAuthorization', beet.bool], - ['claimActionPaymentInfo', beetSolana.publicKey], - ['maxClaimedReceipts', beet.coption(beet.u128)], - ], - 'InitReceiptManagerIx' - ) diff --git a/sdk/generated/types/InitRewardDistributorIx.ts b/sdk/generated/types/InitRewardDistributorIx.ts deleted file mode 100644 index f1336630..00000000 --- a/sdk/generated/types/InitRewardDistributorIx.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -export type InitRewardDistributorIx = { - rewardAmount: beet.bignum - rewardDurationSeconds: beet.bignum - identifier: beet.bignum - supply: beet.COption - defaultMultiplier: beet.COption - multiplierDecimals: beet.COption - maxRewardSecondsReceived: beet.COption - claimRewardsPaymentInfo: web3.PublicKey -} - -/** - * @category userTypes - * @category generated - */ -export const initRewardDistributorIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['rewardAmount', beet.u64], - ['rewardDurationSeconds', beet.u128], - ['identifier', beet.u64], - ['supply', beet.coption(beet.u64)], - ['defaultMultiplier', beet.coption(beet.u64)], - ['multiplierDecimals', beet.coption(beet.u8)], - ['maxRewardSecondsReceived', beet.coption(beet.u128)], - ['claimRewardsPaymentInfo', beetSolana.publicKey], - ], - 'InitRewardDistributorIx' - ) diff --git a/sdk/generated/types/InitStakeBoosterIx.ts b/sdk/generated/types/InitStakeBoosterIx.ts deleted file mode 100644 index b16d4f90..00000000 --- a/sdk/generated/types/InitStakeBoosterIx.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type InitStakeBoosterIx = { - stakePool: web3.PublicKey - identifier: beet.bignum - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] - boostSeconds: beet.bignum - startTimeSeconds: beet.bignum - boostActionPaymentInfo: web3.PublicKey -} - -/** - * @category userTypes - * @category generated - */ -export const initStakeBoosterIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['stakePool', beetSolana.publicKey], - ['identifier', beet.u64], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ['boostSeconds', beet.u128], - ['startTimeSeconds', beet.i64], - ['boostActionPaymentInfo', beetSolana.publicKey], - ], - 'InitStakeBoosterIx' - ) diff --git a/sdk/generated/types/PaymentShare.ts b/sdk/generated/types/PaymentShare.ts deleted file mode 100644 index d1c06542..00000000 --- a/sdk/generated/types/PaymentShare.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import * as beet from '@metaplex-foundation/beet' -export type PaymentShare = { - address: web3.PublicKey - basisPoints: number -} - -/** - * @category userTypes - * @category generated - */ -export const paymentShareBeet = new beet.BeetArgsStruct( - [ - ['address', beetSolana.publicKey], - ['basisPoints', beet.u16], - ], - 'PaymentShare' -) diff --git a/sdk/generated/types/UpdatePaymentInfoIx.ts b/sdk/generated/types/UpdatePaymentInfoIx.ts deleted file mode 100644 index dc991e2d..00000000 --- a/sdk/generated/types/UpdatePaymentInfoIx.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type UpdatePaymentInfoIx = { - authority: web3.PublicKey - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] -} - -/** - * @category userTypes - * @category generated - */ -export const updatePaymentInfoIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['authority', beetSolana.publicKey], - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ], - 'UpdatePaymentInfoIx' - ) diff --git a/sdk/generated/types/UpdatePoolIx.ts b/sdk/generated/types/UpdatePoolIx.ts deleted file mode 100644 index d8e4ce34..00000000 --- a/sdk/generated/types/UpdatePoolIx.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -export type UpdatePoolIx = { - allowedCollections: web3.PublicKey[] - allowedCreators: web3.PublicKey[] - requiresAuthorization: boolean - authority: web3.PublicKey - resetOnUnstake: boolean - cooldownSeconds: beet.COption - minStakeSeconds: beet.COption - endDate: beet.COption - stakePaymentInfo: web3.PublicKey - unstakePaymentInfo: web3.PublicKey -} - -/** - * @category userTypes - * @category generated - */ -export const updatePoolIxBeet = new beet.FixableBeetArgsStruct( - [ - ['allowedCollections', beet.array(beetSolana.publicKey)], - ['allowedCreators', beet.array(beetSolana.publicKey)], - ['requiresAuthorization', beet.bool], - ['authority', beetSolana.publicKey], - ['resetOnUnstake', beet.bool], - ['cooldownSeconds', beet.coption(beet.u32)], - ['minStakeSeconds', beet.coption(beet.u32)], - ['endDate', beet.coption(beet.i64)], - ['stakePaymentInfo', beetSolana.publicKey], - ['unstakePaymentInfo', beetSolana.publicKey], - ], - 'UpdatePoolIx' -) diff --git a/sdk/generated/types/UpdateReceiptManagerIx.ts b/sdk/generated/types/UpdateReceiptManagerIx.ts deleted file mode 100644 index 1d247a83..00000000 --- a/sdk/generated/types/UpdateReceiptManagerIx.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as web3 from '@solana/web3.js' -import * as beet from '@metaplex-foundation/beet' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type UpdateReceiptManagerIx = { - authority: web3.PublicKey - requiredStakeSeconds: beet.bignum - stakeSecondsToUse: beet.bignum - paymentMint: web3.PublicKey - paymentAmount: beet.bignum - paymentShares: PaymentShare[] - requiresAuthorization: boolean - claimActionPaymentInfo: web3.PublicKey - maxClaimedReceipts: beet.COption -} - -/** - * @category userTypes - * @category generated - */ -export const updateReceiptManagerIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['authority', beetSolana.publicKey], - ['requiredStakeSeconds', beet.u128], - ['stakeSecondsToUse', beet.u128], - ['paymentMint', beetSolana.publicKey], - ['paymentAmount', beet.u64], - ['paymentShares', beet.array(paymentShareBeet)], - ['requiresAuthorization', beet.bool], - ['claimActionPaymentInfo', beetSolana.publicKey], - ['maxClaimedReceipts', beet.coption(beet.u128)], - ], - 'UpdateReceiptManagerIx' - ) diff --git a/sdk/generated/types/UpdateRewardDistributorIx.ts b/sdk/generated/types/UpdateRewardDistributorIx.ts deleted file mode 100644 index 70c08d9d..00000000 --- a/sdk/generated/types/UpdateRewardDistributorIx.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -export type UpdateRewardDistributorIx = { - defaultMultiplier: beet.bignum - multiplierDecimals: number - rewardAmount: beet.bignum - rewardDurationSeconds: beet.bignum - maxRewardSecondsReceived: beet.COption - claimRewardsPaymentInfo: web3.PublicKey -} - -/** - * @category userTypes - * @category generated - */ -export const updateRewardDistributorIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['defaultMultiplier', beet.u64], - ['multiplierDecimals', beet.u8], - ['rewardAmount', beet.u64], - ['rewardDurationSeconds', beet.u128], - ['maxRewardSecondsReceived', beet.coption(beet.u128)], - ['claimRewardsPaymentInfo', beetSolana.publicKey], - ], - 'UpdateRewardDistributorIx' - ) diff --git a/sdk/generated/types/UpdateRewardEntryIx.ts b/sdk/generated/types/UpdateRewardEntryIx.ts deleted file mode 100644 index 19d5824d..00000000 --- a/sdk/generated/types/UpdateRewardEntryIx.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -export type UpdateRewardEntryIx = { - multiplier: beet.bignum -} - -/** - * @category userTypes - * @category generated - */ -export const updateRewardEntryIxBeet = - new beet.BeetArgsStruct( - [['multiplier', beet.u64]], - 'UpdateRewardEntryIx' - ) diff --git a/sdk/generated/types/UpdateStakeBoosterIx.ts b/sdk/generated/types/UpdateStakeBoosterIx.ts deleted file mode 100644 index 9b0cdd4f..00000000 --- a/sdk/generated/types/UpdateStakeBoosterIx.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This code was GENERATED using the solita package. - * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality. - * - * See: https://github.com/metaplex-foundation/solita - */ - -import * as beet from '@metaplex-foundation/beet' -import * as web3 from '@solana/web3.js' -import * as beetSolana from '@metaplex-foundation/beet-solana' -import { PaymentShare, paymentShareBeet } from './PaymentShare' -export type UpdateStakeBoosterIx = { - paymentAmount: beet.bignum - paymentMint: web3.PublicKey - paymentShares: PaymentShare[] - boostSeconds: beet.bignum - startTimeSeconds: beet.bignum - boostActionPaymentInfo: web3.PublicKey -} - -/** - * @category userTypes - * @category generated - */ -export const updateStakeBoosterIxBeet = - new beet.FixableBeetArgsStruct( - [ - ['paymentAmount', beet.u64], - ['paymentMint', beetSolana.publicKey], - ['paymentShares', beet.array(paymentShareBeet)], - ['boostSeconds', beet.u128], - ['startTimeSeconds', beet.i64], - ['boostActionPaymentInfo', beetSolana.publicKey], - ], - 'UpdateStakeBoosterIx' - ) diff --git a/sdk/generated/types/index.ts b/sdk/generated/types/index.ts deleted file mode 100644 index 98079539..00000000 --- a/sdk/generated/types/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -export * from './Action' -export * from './BoostStakeEntryIx' -export * from './InitPaymentInfoIx' -export * from './InitPoolIx' -export * from './InitReceiptManagerIx' -export * from './InitRewardDistributorIx' -export * from './InitStakeBoosterIx' -export * from './PaymentShare' -export * from './UpdatePaymentInfoIx' -export * from './UpdatePoolIx' -export * from './UpdateReceiptManagerIx' -export * from './UpdateRewardDistributorIx' -export * from './UpdateRewardEntryIx' -export * from './UpdateStakeBoosterIx' diff --git a/sdk/idl/cardinal_rewards_center_idl.json b/sdk/idl/cardinal_rewards_center_idl.json index bf4a5936..ad7ea890 100644 --- a/sdk/idl/cardinal_rewards_center_idl.json +++ b/sdk/idl/cardinal_rewards_center_idl.json @@ -2170,8 +2170,5 @@ "name": "InvalidAuthorityTokenAccount", "msg": "Invalid authority token account" } - ], - "metadata": { - "address": "rwcn6Ry17ChPXpJCN2hoK5kwpgFarQqzycXwVJ3om7U" - } + ] } \ No newline at end of file diff --git a/sdk/index.ts b/sdk/index.ts index e59b4666..d1dbcc89 100644 --- a/sdk/index.ts +++ b/sdk/index.ts @@ -1,7 +1,6 @@ export * from "./accounts"; export * from "./api"; export * from "./constants"; -export * from "./generated"; export * from "./idl/cardinal_rewards_center"; export * from "./payment"; export * from "./pda"; diff --git a/sdk/payment.ts b/sdk/payment.ts index c505b9ba..f2d8d98a 100644 --- a/sdk/payment.ts +++ b/sdk/payment.ts @@ -11,7 +11,8 @@ import type { } from "@solana/web3.js"; import { PublicKey, SystemProgram } from "@solana/web3.js"; -import { PaymentInfo } from "./generated"; +import { fetchIdlAccount } from "./accounts"; +import type { PaymentShare } from "./constants"; export const BASIS_POINTS_DIVISOR = 10_000; @@ -21,9 +22,10 @@ export const withRemainingAccountsForPaymentInfo = async ( payer: PublicKey, paymentInfo: PublicKey ): Promise => { - const paymentInfoData = await PaymentInfo.fromAccountAddress( + const paymentInfoData = await fetchIdlAccount( connection, - paymentInfo + paymentInfo, + "paymentInfo" ); const remainingAccounts: AccountMeta[] = [ { @@ -34,15 +36,18 @@ export const withRemainingAccountsForPaymentInfo = async ( ]; // add payer - if (Number(paymentInfoData.paymentAmount) === 0) return remainingAccounts; + if (Number(paymentInfoData.parsed.paymentAmount) === 0) + return remainingAccounts; remainingAccounts.push( ...(await withRemainingAccountsForPayment( connection, transaction, payer, - paymentInfoData.paymentMint, - paymentInfoData.paymentShares.map((p) => p.address) + paymentInfoData.parsed.paymentMint, + (paymentInfoData.parsed.paymentShares as PaymentShare[]).map( + (p) => p.address + ) )) ); return remainingAccounts; diff --git a/sdk/pda.ts b/sdk/pda.ts index d67b1405..525c56ad 100644 --- a/sdk/pda.ts +++ b/sdk/pda.ts @@ -1,7 +1,7 @@ import { BN, utils } from "@project-serum/anchor"; import { PublicKey } from "@solana/web3.js"; -import { PROGRAM_ID } from "./generated"; +import { REWARDS_CENTER_ADDRESS } from "./constants"; export const STAKE_ENTRY_SEED = "stake-entry"; export const findStakeEntryId = ( @@ -17,7 +17,7 @@ export const findStakeEntryId = ( mintId.toBuffer(), user && isFungible ? user.toBuffer() : PublicKey.default.toBuffer(), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -28,7 +28,7 @@ export const findStakePoolId = (identifier: string): PublicKey => { utils.bytes.utf8.encode(STAKE_POOL_SEED), utils.bytes.utf8.encode(identifier), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -43,7 +43,7 @@ export const findStakeAuthorizationRecordId = ( stakePoolId.toBuffer(), mintId.toBuffer(), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -51,7 +51,7 @@ export const USER_ESCROW_SEED = "escrow"; export const findUserEscrowId = (user: PublicKey): PublicKey => { return PublicKey.findProgramAddressSync( [utils.bytes.utf8.encode(USER_ESCROW_SEED), user.toBuffer()], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -66,7 +66,7 @@ export const findStakeBoosterId = ( stakePoolId.toBuffer(), (identifier ?? new BN(0)).toArrayLike(Buffer, "le", 8), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -81,7 +81,7 @@ export const findRewardDistributorId = ( stakePoolId.toBuffer(), (identifier ?? new BN(0)).toArrayLike(Buffer, "le", 8), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -96,7 +96,7 @@ export const findRewardEntryId = ( rewardDistributorId.toBuffer(), stakeEntryId.toBuffer(), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -111,7 +111,7 @@ export const findReceiptManagerId = ( stakePoolId.toBuffer(), utils.bytes.utf8.encode(identifier), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -126,7 +126,7 @@ export const findRewardReceiptId = ( receiptManagerId.toBuffer(), stakeEntryId.toBuffer(), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; @@ -137,6 +137,6 @@ export const findPaymentInfoId = (identifier: string): PublicKey => { utils.bytes.utf8.encode(PAYMENT_INFO_SEED), utils.bytes.utf8.encode(identifier), ], - PROGRAM_ID + REWARDS_CENTER_ADDRESS )[0]; }; diff --git a/sdk/rewardDistribution.ts b/sdk/rewardDistribution.ts index a0b85b86..099a8bf5 100644 --- a/sdk/rewardDistribution.ts +++ b/sdk/rewardDistribution.ts @@ -1,10 +1,9 @@ -import type { AccountData } from "@cardinal/common"; import { BN } from "@project-serum/anchor"; import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token"; import type { Connection, PublicKey } from "@solana/web3.js"; -import { fetchAccountDataById } from "./accounts"; -import type { RewardDistributor, RewardEntry, StakeEntry } from "./generated"; +import { fetchIdlAccountDataById } from "./accounts"; +import type { RewardDistributor, RewardEntry, StakeEntry } from "./constants"; import { findRewardEntryId } from "./pda"; import { findStakeEntryIdFromMint } from "./utils"; @@ -20,7 +19,7 @@ export const getPendingRewardsForPool = async ( connection: Connection, wallet: PublicKey, mintIds: PublicKey[], - rewardDistributor: AccountData, + rewardDistributor: RewardDistributor, UTCNow: number ): Promise<{ rewardMap: { @@ -54,7 +53,7 @@ export const getPendingRewardsForPool = async ( findRewardEntryId(rewardDistributor.pubkey, stakeEntryId) ); - const accountDataById = await fetchAccountDataById(connection, [ + const accountDataById = await fetchIdlAccountDataById(connection, [ ...stakeEntryIds, ...rewardEntryIds, ]); @@ -68,7 +67,7 @@ export const getPendingRewardsForPool = async ( } return acc; }, - [[], []] as [AccountData[], AccountData[]] + [[], []] as [StakeEntry[], RewardEntry[]] ); return getRewardMap( stakeEntries, @@ -89,9 +88,9 @@ export const getPendingRewardsForPool = async ( * @returns */ export const getRewardMap = ( - stakeEntries: AccountData[], - rewardEntries: AccountData[], - rewardDistributor: AccountData, + stakeEntries: StakeEntry[], + rewardEntries: RewardEntry[], + rewardDistributor: RewardDistributor, remainingRewardAmount: BN, UTCNow: number ): { @@ -147,9 +146,9 @@ export const getRewardMap = ( * @returns */ export const calculatePendingRewards = ( - rewardDistributor: AccountData, - stakeEntry: AccountData, - rewardEntry: AccountData | undefined, + rewardDistributor: RewardDistributor, + stakeEntry: StakeEntry, + rewardEntry: RewardEntry | undefined, remainingRewardAmount: BN, UTCNow: number ): [BN, BN] => { diff --git a/sdk/utils.ts b/sdk/utils.ts index d8ac67a8..499998a0 100644 --- a/sdk/utils.ts +++ b/sdk/utils.ts @@ -1,9 +1,16 @@ +import { utils } from "@project-serum/anchor"; +import { findProgramAddressSync } from "@project-serum/anchor/dist/cjs/utils/pubkey"; import { getMint } from "@solana/spl-token"; -import type { Connection, PublicKey } from "@solana/web3.js"; +import type { Connection } from "@solana/web3.js"; +import { PublicKey } from "@solana/web3.js"; import { BN } from "bn.js"; import { findStakeEntryId } from "./pda"; +export const METADATA_PROGRAM_ID = new PublicKey( + "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" +); + /** * Convenience method to find the stake entry id from a mint * NOTE: This will lookup the mint on-chain to get the supply @@ -23,3 +30,26 @@ export const findStakeEntryIdFromMint = async ( } return findStakeEntryId(stakePoolId, stakeMintId, user, isFungible); }; + +export const findMintMetadataId = (mintId: PublicKey): PublicKey => { + return findProgramAddressSync( + [ + utils.bytes.utf8.encode("metadata"), + METADATA_PROGRAM_ID.toBuffer(), + mintId.toBuffer(), + ], + METADATA_PROGRAM_ID + )[0]; +}; + +export const findMintEditionId = (mintId: PublicKey): PublicKey => { + return findProgramAddressSync( + [ + utils.bytes.utf8.encode("metadata"), + METADATA_PROGRAM_ID.toBuffer(), + mintId.toBuffer(), + utils.bytes.utf8.encode("edition"), + ], + METADATA_PROGRAM_ID + )[0]; +}; diff --git a/tests/reward-distribution/claim-rewards-sol.test.ts b/tests/reward-distribution/claim-rewards-sol.test.ts index c3cb8654..d7cbfe4e 100644 --- a/tests/reward-distribution/claim-rewards-sol.test.ts +++ b/tests/reward-distribution/claim-rewards-sol.test.ts @@ -6,27 +6,26 @@ import { getAssociatedTokenAddressSync, } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, LAMPORTS_PER_SOL, Transaction } from "@solana/web3.js"; +import { + Keypair, + LAMPORTS_PER_SOL, + SystemProgram, + Transaction, +} from "@solana/web3.js"; import { BN } from "bn.js"; import { CLAIM_REWARDS_PAYMENT_INFO, claimRewards, + fetchIdlAccount, findRewardDistributorId, findRewardEntryId, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, } from "../../sdk"; -import { - createInitPoolInstruction, - createInitRewardDistributorInstruction, - RewardDistributor, - RewardEntry, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -73,67 +72,70 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Init reward distributor", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const rewardDistributorId = findRewardDistributorId(stakePoolId); - tx.add( - createInitRewardDistributorInstruction( - { - rewardDistributor: rewardDistributorId, - stakePool: stakePoolId, - rewardMint: rewardMintId, - authority: provider.wallet.publicKey, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: new BN(0), - rewardAmount: REWARD_AMOUNT, - rewardDurationSeconds: REWARD_SECONDS, - supply: null, - defaultMultiplier: 1, - multiplierDecimals: 0, - maxRewardSecondsReceived: null, - claimRewardsPaymentInfo: CLAIM_REWARDS_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initRewardDistributor({ + identifier: new BN(0), + rewardAmount: new BN(REWARD_AMOUNT), + rewardDurationSeconds: new BN(REWARD_SECONDS), + supply: null, + defaultMultiplier: new BN(1), + multiplierDecimals: 0, + maxRewardSecondsReceived: null, + claimRewardsPaymentInfo: CLAIM_REWARDS_PAYMENT_INFO, + }) + .accounts({ + rewardDistributor: rewardDistributorId, + stakePool: stakePoolId, + rewardMint: rewardMintId, + authority: provider.wallet.publicKey, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); const userRewardMintAta = getAssociatedTokenAddressSync( rewardMintId, @@ -157,16 +159,22 @@ test("Init reward distributor", async () => { ) ); await executeTransaction(provider.connection, tx, provider.wallet); - const rewardDistributor = await RewardDistributor.fromAccountAddress( + const rewardDistributor = await fetchIdlAccount( provider.connection, - rewardDistributorId + rewardDistributorId, + "rewardDistributor" ); - expect(rewardDistributor.authority.toString()).toBe( + expect(rewardDistributor.parsed.authority.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(rewardDistributor.rewardMint.toString()).toBe(rewardMintId.toString()); - expect(rewardDistributor.multiplierDecimals).toBe(0); - expect(Number(rewardDistributor.defaultMultiplier)).toBe(1); + expect(rewardDistributor.parsed.rewardMint.toString()).toBe( + rewardMintId.toString() + ); + expect(rewardDistributor.parsed.multiplierDecimals).toBe(0); + expect(Number(rewardDistributor.parsed.defaultMultiplier)).toBe(1); + expect(rewardDistributor.parsed.claimRewardsPaymentInfo.toString()).toBe( + CLAIM_REWARDS_PAYMENT_INFO.toString() + ); // reward account check const rewardDistributorAta = await getAccount( @@ -178,6 +186,7 @@ test("Init reward distributor", async () => { }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await executeTransactions( provider.connection, await stake(provider.connection, provider.wallet, stakePoolIdentifier, [ @@ -192,31 +201,38 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); test("Claim rewards", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 4000)); const rewardDistributorId = findRewardDistributorId( findStakePoolId(stakePoolIdentifier) @@ -249,33 +265,39 @@ test("Claim rewards", async () => { // check stake entry const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBeGreaterThan(1); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBeGreaterThan( + 1 + ); // check reward entry const rewardEntryId = findRewardEntryId(rewardDistributorId, stakeEntryId); - const rewardEntry = await RewardEntry.fromAccountAddress( + const rewardEntry = await fetchIdlAccount( provider.connection, - rewardEntryId + rewardEntryId, + "rewardEntry" ); - expect(rewardEntry.stakeEntry.toString()).toBe(stakeEntryId.toString()); - expect(rewardEntry.rewardDistributor.toString()).toBe( + expect(rewardEntry.parsed.stakeEntry.toString()).toBe( + stakeEntryId.toString() + ); + expect(rewardEntry.parsed.rewardDistributor.toString()).toBe( rewardDistributorId.toString() ); - expect(Number(rewardEntry.rewardSecondsReceived)).toBeGreaterThan(0); + expect(Number(rewardEntry.parsed.rewardSecondsReceived)).toBeGreaterThan(0); // check staked const userAtaId = getAssociatedTokenAddressSync( @@ -285,9 +307,14 @@ test("Claim rewards", async () => { const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); // check rewards diff --git a/tests/reward-distribution/claim-rewards.test.ts b/tests/reward-distribution/claim-rewards.test.ts index 047a9a76..a2fe0dc7 100644 --- a/tests/reward-distribution/claim-rewards.test.ts +++ b/tests/reward-distribution/claim-rewards.test.ts @@ -10,27 +10,26 @@ import { NATIVE_MINT, } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, LAMPORTS_PER_SOL, Transaction } from "@solana/web3.js"; +import { + Keypair, + LAMPORTS_PER_SOL, + SystemProgram, + Transaction, +} from "@solana/web3.js"; import { BN } from "bn.js"; import { claimRewards, + fetchIdlAccount, findRewardDistributorId, findRewardEntryId, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, WRAPPED_SOL_PAYMENT_INFO, } from "../../sdk"; -import { - createInitPoolInstruction, - createInitRewardDistributorInstruction, - RewardDistributor, - RewardEntry, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -88,67 +87,70 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Init reward distributor", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const rewardDistributorId = findRewardDistributorId(stakePoolId); - tx.add( - createInitRewardDistributorInstruction( - { - rewardDistributor: rewardDistributorId, - stakePool: stakePoolId, - rewardMint: rewardMintId, - authority: provider.wallet.publicKey, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: new BN(0), - rewardAmount: REWARD_AMOUNT, - rewardDurationSeconds: REWARD_SECONDS, - supply: null, - defaultMultiplier: 1, - multiplierDecimals: 0, - maxRewardSecondsReceived: null, - claimRewardsPaymentInfo: WRAPPED_SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initRewardDistributor({ + identifier: new BN(0), + rewardAmount: new BN(REWARD_AMOUNT), + rewardDurationSeconds: new BN(REWARD_SECONDS), + supply: null, + defaultMultiplier: new BN(1), + multiplierDecimals: 0, + maxRewardSecondsReceived: null, + claimRewardsPaymentInfo: WRAPPED_SOL_PAYMENT_INFO, + }) + .accounts({ + rewardDistributor: rewardDistributorId, + stakePool: stakePoolId, + rewardMint: rewardMintId, + authority: provider.wallet.publicKey, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); const userRewardMintAta = getAssociatedTokenAddressSync( rewardMintId, @@ -172,16 +174,22 @@ test("Init reward distributor", async () => { ) ); await executeTransaction(provider.connection, tx, provider.wallet); - const rewardDistributor = await RewardDistributor.fromAccountAddress( + const rewardDistributor = await fetchIdlAccount( provider.connection, - rewardDistributorId + rewardDistributorId, + "rewardDistributor" ); - expect(rewardDistributor.authority.toString()).toBe( + expect(rewardDistributor.parsed.authority.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(rewardDistributor.rewardMint.toString()).toBe(rewardMintId.toString()); - expect(rewardDistributor.multiplierDecimals).toBe(0); - expect(Number(rewardDistributor.defaultMultiplier)).toBe(1); + expect(rewardDistributor.parsed.rewardMint.toString()).toBe( + rewardMintId.toString() + ); + expect(rewardDistributor.parsed.multiplierDecimals).toBe(0); + expect(Number(rewardDistributor.parsed.defaultMultiplier)).toBe(1); + expect(rewardDistributor.parsed.claimRewardsPaymentInfo.toString()).toBe( + WRAPPED_SOL_PAYMENT_INFO.toString() + ); // reward account check const rewardDistributorAta = await getAccount( @@ -193,6 +201,7 @@ test("Init reward distributor", async () => { }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await executeTransactions( provider.connection, await stake(provider.connection, provider.wallet, stakePoolIdentifier, [ @@ -207,31 +216,38 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); test("Claim rewards", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 4000)); const rewardDistributorId = findRewardDistributorId( findStakePoolId(stakePoolIdentifier) @@ -267,33 +283,39 @@ test("Claim rewards", async () => { // check stake entry const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBeGreaterThan(1); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBeGreaterThan( + 1 + ); // check reward entry const rewardEntryId = findRewardEntryId(rewardDistributorId, stakeEntryId); - const rewardEntry = await RewardEntry.fromAccountAddress( + const rewardEntry = await fetchIdlAccount( provider.connection, - rewardEntryId + rewardEntryId, + "rewardEntry" ); - expect(rewardEntry.stakeEntry.toString()).toBe(stakeEntryId.toString()); - expect(rewardEntry.rewardDistributor.toString()).toBe( + expect(rewardEntry.parsed.stakeEntry.toString()).toBe( + stakeEntryId.toString() + ); + expect(rewardEntry.parsed.rewardDistributor.toString()).toBe( rewardDistributorId.toString() ); - expect(Number(rewardEntry.rewardSecondsReceived)).toBeGreaterThan(0); + expect(Number(rewardEntry.parsed.rewardSecondsReceived)).toBeGreaterThan(0); // check staked const userAtaId = getAssociatedTokenAddressSync( @@ -303,9 +325,14 @@ test("Claim rewards", async () => { const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); // check rewards diff --git a/tests/reward-receipts/stake-claim-receipt.test.ts b/tests/reward-receipts/stake-claim-receipt.test.ts index 89111115..bff7a66d 100644 --- a/tests/reward-receipts/stake-claim-receipt.test.ts +++ b/tests/reward-receipts/stake-claim-receipt.test.ts @@ -6,25 +6,20 @@ import { NATIVE_MINT, } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, Transaction } from "@solana/web3.js"; +import { Keypair, SystemProgram, Transaction } from "@solana/web3.js"; +import BN from "bn.js"; import { claimRewardReceipt, + fetchIdlAccount, findReceiptManagerId, findRewardReceiptId, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, } from "../../sdk"; -import { - createInitPoolInstruction, - createInitReceiptManagerInstruction, - ReceiptManager, - RewardReceipt, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -69,86 +64,91 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); }); test("Create receipt manager", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const receiptManagerId = findReceiptManagerId( stakePoolId, RECEIPT_MANAGER_IDENTIFIER ); - tx.add( - createInitReceiptManagerInstruction( - { - receiptManager: receiptManagerId, - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - name: RECEIPT_MANAGER_IDENTIFIER, - authority: provider.wallet.publicKey, - requiredStakeSeconds: 0, - stakeSecondsToUse: STAKE_SECONDS_TO_USE, - paymentMint: paymentMintId, - paymentAmount: PAYMENT_AMOUNT, - paymentShares: [{ address: paymentRecipientId, basisPoints: 10000 }], - requiresAuthorization: false, - maxClaimedReceipts: null, - claimActionPaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + + const ix = await program.methods + .initReceiptManager({ + name: RECEIPT_MANAGER_IDENTIFIER, + authority: provider.wallet.publicKey, + requiredStakeSeconds: new BN(0), + stakeSecondsToUse: new BN(STAKE_SECONDS_TO_USE), + paymentMint: paymentMintId, + paymentAmount: new BN(PAYMENT_AMOUNT), + paymentShares: [{ address: paymentRecipientId, basisPoints: 10000 }], + requiresAuthorization: false, + maxClaimedReceipts: null, + claimActionPaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + receiptManager: receiptManagerId, + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const receiptManager = await ReceiptManager.fromAccountAddress( + const receiptManager = await fetchIdlAccount( provider.connection, - receiptManagerId + receiptManagerId, + "receiptManager" ); - expect(receiptManager.authority.toString()).toBe( + expect(receiptManager.parsed.authority.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(receiptManager.paymentMint.toString()).toBe(paymentMintId.toString()); - expect(receiptManager.requiresAuthorization).toBe(false); - expect(receiptManager.stakeSecondsToUse.toString()).toBe( + expect(receiptManager.parsed.paymentMint.toString()).toBe( + paymentMintId.toString() + ); + expect(receiptManager.parsed.requiresAuthorization).toBe(false); + expect(receiptManager.parsed.stakeSecondsToUse.toString()).toBe( STAKE_SECONDS_TO_USE.toString() ); }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await executeTransactions( provider.connection, await stake(provider.connection, provider.wallet, stakePoolIdentifier, [ @@ -163,31 +163,38 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); test("Claim receipt", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 4000)); const receiptManagerId = findReceiptManagerId( findStakePoolId(stakePoolIdentifier), @@ -216,31 +223,37 @@ test("Claim receipt", async () => { // check stake entry const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBeGreaterThan(1); - expect(Number(entry.usedStakeSeconds)).toBe(STAKE_SECONDS_TO_USE); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBeGreaterThan( + 1 + ); + expect(Number(entry.parsed.usedStakeSeconds)).toBe(STAKE_SECONDS_TO_USE); // check reward receipt const rewardReceiptId = findRewardReceiptId(receiptManagerId, stakeEntryId); - const rewardReceipt = await RewardReceipt.fromAccountAddress( + const rewardReceipt = await fetchIdlAccount( provider.connection, - rewardReceiptId + rewardReceiptId, + "rewardReceipt" + ); + expect(rewardReceipt.parsed.stakeEntry.toString()).toBe( + stakeEntryId.toString() ); - expect(rewardReceipt.stakeEntry.toString()).toBe(stakeEntryId.toString()); - expect(rewardReceipt.target.toString()).toBe( + expect(rewardReceipt.parsed.target.toString()).toBe( provider.wallet.publicKey.toString() ); @@ -252,9 +265,14 @@ test("Claim receipt", async () => { const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); // check payment diff --git a/tests/stake-booster/stake-booster-init-update.test.ts b/tests/stake-booster/stake-booster-init-update.test.ts index 15f6d683..d9520dec 100644 --- a/tests/stake-booster/stake-booster-init-update.test.ts +++ b/tests/stake-booster/stake-booster-init-update.test.ts @@ -2,21 +2,17 @@ import { withWrapSol } from "@cardinal/common"; import { beforeAll, expect, test } from "@jest/globals"; import { NATIVE_MINT } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, Transaction } from "@solana/web3.js"; +import { Keypair, SystemProgram, Transaction } from "@solana/web3.js"; +import { BN } from "bn.js"; import { BASIS_POINTS_DIVISOR, + fetchIdlAccount, findStakeBoosterId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, } from "../../sdk"; -import { - createInitPoolInstruction, - createInitStakeBoosterInstruction, - createUpdateStakeBoosterInstruction, - StakeBooster, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { executeTransaction, getProvider } from "../utils"; @@ -44,110 +40,118 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Create stake booster", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeBoosterId = findStakeBoosterId(stakePoolId); - tx.add( - createInitStakeBoosterInstruction( - { - stakeBooster: stakeBoosterId, - stakePool: stakePoolId, - authority: provider.wallet.publicKey, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: 0, - stakePool: stakePoolId, - paymentAmount: PAYMENT_AMOUNT, - paymentMint: paymentMintId, - paymentShares: [ - { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, - ], - boostSeconds: 2, - startTimeSeconds: 0, - boostActionPaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initStakeBooster({ + identifier: new BN(0), + stakePool: stakePoolId, + paymentAmount: new BN(PAYMENT_AMOUNT), + paymentMint: paymentMintId, + paymentShares: [ + { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, + ], + boostSeconds: new BN(2), + startTimeSeconds: new BN(0), + boostActionPaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakeBooster: stakeBoosterId, + stakePool: stakePoolId, + authority: provider.wallet.publicKey, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const stakeBooster = await StakeBooster.fromAccountAddress( + const stakeBooster = await fetchIdlAccount( provider.connection, - stakeBoosterId + stakeBoosterId, + "stakeBooster" ); - expect(stakeBooster.paymentMint.toString()).toBe(paymentMintId.toString()); - expect(Number(stakeBooster.boostSeconds)).toBe(2); - expect(Number(stakeBooster.paymentAmount)).toBe(PAYMENT_AMOUNT); + expect(stakeBooster.parsed.paymentMint.toString()).toBe( + paymentMintId.toString() + ); + expect(Number(stakeBooster.parsed.boostSeconds)).toBe(2); + expect(Number(stakeBooster.parsed.paymentAmount)).toBe(PAYMENT_AMOUNT); }); test("Update stake booster", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeBoosterId = findStakeBoosterId(stakePoolId); - tx.add( - createUpdateStakeBoosterInstruction( - { - stakeBooster: stakeBoosterId, - stakePool: stakePoolId, - authority: provider.wallet.publicKey, - }, - { - ix: { - paymentAmount: PAYMENT_AMOUNT, - paymentMint: paymentMintId, - paymentShares: [ - { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, - ], - boostSeconds: 4, - startTimeSeconds: 4, - boostActionPaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + + const ix = await program.methods + .updateStakeBooster({ + paymentAmount: new BN(PAYMENT_AMOUNT), + paymentMint: paymentMintId, + paymentShares: [ + { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, + ], + boostSeconds: new BN(4), + startTimeSeconds: new BN(4), + boostActionPaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakeBooster: stakeBoosterId, + stakePool: stakePoolId, + authority: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const stakeBooster = await StakeBooster.fromAccountAddress( + const stakeBooster = await fetchIdlAccount( provider.connection, - stakeBoosterId + stakeBoosterId, + "stakeBooster" + ); + expect(stakeBooster.parsed.paymentMint.toString()).toBe( + paymentMintId.toString() ); - expect(stakeBooster.paymentMint.toString()).toBe(paymentMintId.toString()); - expect(Number(stakeBooster.boostSeconds)).toBe(4); - expect(Number(stakeBooster.startTimeSeconds)).toBe(4); - expect(Number(stakeBooster.paymentAmount)).toBe(PAYMENT_AMOUNT); + expect(Number(stakeBooster.parsed.boostSeconds)).toBe(4); + expect(Number(stakeBooster.parsed.startTimeSeconds)).toBe(4); + expect(Number(stakeBooster.parsed.paymentAmount)).toBe(PAYMENT_AMOUNT); }); diff --git a/tests/stake-booster/stake-booster.test.ts b/tests/stake-booster/stake-booster.test.ts index 883b2b7f..360e6543 100644 --- a/tests/stake-booster/stake-booster.test.ts +++ b/tests/stake-booster/stake-booster.test.ts @@ -6,24 +6,20 @@ import { NATIVE_MINT, } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, Transaction } from "@solana/web3.js"; +import { Keypair, SystemProgram, Transaction } from "@solana/web3.js"; +import { BN } from "bn.js"; import { BASIS_POINTS_DIVISOR, boost, + fetchIdlAccount, findStakeBoosterId, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, } from "../../sdk"; -import { - createInitPoolInstruction, - createInitStakeBoosterInstruction, - StakeBooster, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -67,80 +63,89 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Create stake booster", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeBoosterId = findStakeBoosterId(stakePoolId); - tx.add( - createInitStakeBoosterInstruction( - { - stakeBooster: stakeBoosterId, - stakePool: stakePoolId, - authority: provider.wallet.publicKey, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: 0, - stakePool: stakePoolId, - paymentAmount: PAYMENT_AMOUNT, - paymentMint: paymentMintId, - paymentShares: [ - { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, - ], - boostSeconds: 1, - startTimeSeconds: Date.now() / 1000 - 1000, - boostActionPaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initStakeBooster({ + identifier: new BN(0), + stakePool: stakePoolId, + paymentAmount: new BN(PAYMENT_AMOUNT), + paymentMint: paymentMintId, + paymentShares: [ + { address: paymentRecipientId, basisPoints: BASIS_POINTS_DIVISOR }, + ], + boostSeconds: new BN(1), + startTimeSeconds: new BN(Date.now() / 1000 - 1000), + boostActionPaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakeBooster: stakeBoosterId, + stakePool: stakePoolId, + authority: provider.wallet.publicKey, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const stakeBooster = await StakeBooster.fromAccountAddress( + const stakeBooster = await fetchIdlAccount( provider.connection, - stakeBoosterId + stakeBoosterId, + "stakeBooster" + ); + expect(stakeBooster.parsed.paymentMint.toString()).toBe( + paymentMintId.toString() + ); + expect(Number(stakeBooster.parsed.boostSeconds)).toBe(1); + expect(stakeBooster.parsed.paymentAmount.toString()).toBe( + PAYMENT_AMOUNT.toString() ); - expect(stakeBooster.paymentMint.toString()).toBe(paymentMintId.toString()); - expect(Number(stakeBooster.boostSeconds)).toBe(1); - expect(stakeBooster.paymentAmount.toString()).toBe(PAYMENT_AMOUNT.toString()); }); test("Stake", async () => { // miss 3 seconds + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 3000)); await executeTransactions( provider.connection, @@ -156,49 +161,57 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); test("Boost", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 1000)); // check stake entry before const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - const entryBefore = await StakeEntry.fromAccountAddress( + const entryBefore = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entryBefore.stakeMint.toString()).toBe(mintId.toString()); - expect(entryBefore.lastStaker.toString()).toBe( + expect(entryBefore.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entryBefore.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entryBefore.totalStakeSeconds.toString())).toBe(0); - expect(parseInt(entryBefore.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entryBefore.parsed.totalStakeSeconds.toString())).toBe(0); + expect(parseInt(entryBefore.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entryBefore.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entryBefore.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); @@ -225,21 +238,22 @@ test("Boost", async () => { ); // check stake entry - const entryAfter = await StakeEntry.fromAccountAddress( + const entryAfter = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(Number(entryAfter.totalStakeSeconds)).toBeGreaterThanOrEqual( + expect(Number(entryAfter.parsed.totalStakeSeconds)).toBeGreaterThanOrEqual( STAKE_SECONDS_TO_BOOST ); - expect(entryAfter.stakeMint.toString()).toBe(mintId.toString()); - expect(entryAfter.lastStaker.toString()).toBe( + expect(entryAfter.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entryAfter.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(Number(entryAfter.lastStakedAt)).toBeGreaterThan( + expect(Number(entryAfter.parsed.lastStakedAt)).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(Number(entryAfter.lastUpdatedAt)).toBeGreaterThan( + expect(Number(entryAfter.parsed.lastUpdatedAt)).toBeGreaterThan( Date.now() / 1000 - 60 ); @@ -251,9 +265,14 @@ test("Boost", async () => { const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(Number(userAta.amount)).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); // check payment diff --git a/tests/stake-entry/stake-reset-entry.test.ts b/tests/stake-entry/stake-reset-entry.test.ts index 809041b6..a3ceec3f 100644 --- a/tests/stake-entry/stake-reset-entry.test.ts +++ b/tests/stake-entry/stake-reset-entry.test.ts @@ -2,20 +2,16 @@ import { beforeAll, expect, test } from "@jest/globals"; import { Wallet } from "@project-serum/anchor"; import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token"; import type { PublicKey } from "@solana/web3.js"; -import { Keypair, Transaction } from "@solana/web3.js"; +import { Keypair, SystemProgram, Transaction } from "@solana/web3.js"; import { + fetchIdlAccount, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, } from "../../sdk"; -import { - createInitPoolInstruction, - createResetStakeEntryInstruction, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -48,41 +44,44 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); + expect(pool.parsed.requiresAuthorization).toBe(false); }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await executeTransactions( provider.connection, await stake(provider.connection, provider.wallet, stakePoolIdentifier, [ @@ -97,27 +96,33 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); @@ -135,18 +140,21 @@ test("Stake again fail", async () => { }); test("Reset fail", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); + const ix = await program.methods + .resetStakeEntry() + .accounts({ + stakePool: stakePoolId, + stakeEntry: stakeEntryId, + authority: nonAuthority.publicKey, + }) + .instruction(); await expect( executeTransaction( provider.connection, - new Transaction().add( - createResetStakeEntryInstruction({ - stakePool: stakePoolId, - stakeEntry: stakeEntryId, - authority: nonAuthority.publicKey, - }) - ), + new Transaction().add(ix), new Wallet(nonAuthority), { silent: true } ) @@ -155,22 +163,26 @@ test("Reset fail", async () => { test("Reset stake entry", async () => { await new Promise((r) => setTimeout(r, 2000)); + const program = rewardsCenterProgram(provider.connection, provider.wallet); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - const stakeEntry = await StakeEntry.fromAccountAddress( + const stakeEntry = await fetchIdlAccount( provider.connection, - stakeEntryId - ); + stakeEntryId, + "stakeEntry" + ); + const ix = await program.methods + .resetStakeEntry() + .accounts({ + stakePool: stakePoolId, + stakeEntry: stakeEntryId, + authority: provider.wallet.publicKey, + }) + .instruction(); await executeTransaction( provider.connection, - new Transaction().add( - createResetStakeEntryInstruction({ - stakePool: stakePoolId, - stakeEntry: stakeEntryId, - authority: provider.wallet.publicKey, - }) - ), + new Transaction().add(ix), provider.wallet, { silent: true } ); @@ -179,27 +191,33 @@ test("Reset stake entry", async () => { mintId, provider.wallet.publicKey ); - const checkEntry = await StakeEntry.fromAccountAddress( + const checkEntry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(checkEntry.stakeMint.toString()).toBe(mintId.toString()); - expect(checkEntry.lastStaker.toString()).toBe( + expect(checkEntry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(checkEntry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(checkEntry.lastStakedAt.toString())).toBeGreaterThan( - parseInt(stakeEntry.lastStakedAt.toString()) + expect(parseInt(checkEntry.parsed.lastStakedAt.toString())).toBeGreaterThan( + parseInt(stakeEntry.parsed.lastStakedAt.toString()) ); - expect(parseInt(checkEntry.lastUpdatedAt.toString())).toBeGreaterThan( - parseInt(stakeEntry.lastUpdatedAt.toString()) + expect(parseInt(checkEntry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( + parseInt(stakeEntry.parsed.lastUpdatedAt.toString()) ); - expect(checkEntry.cooldownStartSeconds).toBe(null); + expect(checkEntry.parsed.cooldownStartSeconds).toBe(null); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); diff --git a/tests/stake-entry/stake-spl-payment.test.ts b/tests/stake-entry/stake-spl-payment.test.ts index e75d07a7..859d60d7 100644 --- a/tests/stake-entry/stake-spl-payment.test.ts +++ b/tests/stake-entry/stake-spl-payment.test.ts @@ -9,22 +9,19 @@ import { Keypair, LAMPORTS_PER_SOL, PublicKey, + SystemProgram, Transaction, } from "@solana/web3.js"; import { + fetchIdlAccount, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, stake, unstake, WRAPPED_SOL_PAYMENT_INFO, } from "../../sdk"; -import { - createInitPoolInstruction, - PaymentInfo, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -63,41 +60,47 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - stakePaymentInfo: WRAPPED_SOL_PAYMENT_INFO, - unstakePaymentInfo: WRAPPED_SOL_PAYMENT_INFO, - endDate: null, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: WRAPPED_SOL_PAYMENT_INFO, + unstakePaymentInfo: WRAPPED_SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + WRAPPED_SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const userPaymentAta = await getAccount( provider.connection, getAssociatedTokenAddressSync(paymentMintId, provider.wallet.publicKey) @@ -117,32 +120,39 @@ test("Stake", async () => { provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); - const paymentInfo = await PaymentInfo.fromAccountAddress( + const paymentInfo = await fetchIdlAccount( provider.connection, - WRAPPED_SOL_PAYMENT_INFO + WRAPPED_SOL_PAYMENT_INFO, + "paymentInfo" ); const userPaymentAtaAfter = await getAccount( provider.connection, @@ -150,10 +160,11 @@ test("Stake", async () => { ); expect( Number(userPaymentAta.amount) - Number(userPaymentAtaAfter.amount) - ).toBe(Number(paymentInfo.paymentAmount)); + ).toBe(Number(paymentInfo.parsed.paymentAmount)); }); test("Unstake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const userPaymentAta = await getAccount( provider.connection, getAssociatedTokenAddressSync(paymentMintId, provider.wallet.publicKey) @@ -174,31 +185,40 @@ test("Unstake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe(PublicKey.default.toString()); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe(PublicKey.default.toString()); + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBeGreaterThan(1); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBeGreaterThan( + 1 + ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(false); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(0); - const paymentInfo = await PaymentInfo.fromAccountAddress( + const paymentInfo = await fetchIdlAccount( provider.connection, - WRAPPED_SOL_PAYMENT_INFO + WRAPPED_SOL_PAYMENT_INFO, + "paymentInfo" ); const userPaymentAtaAfter = await getAccount( provider.connection, @@ -206,5 +226,5 @@ test("Unstake", async () => { ); expect( Number(userPaymentAta.amount) - Number(userPaymentAtaAfter.amount) - ).toBe(Number(paymentInfo.paymentAmount)); + ).toBe(Number(paymentInfo.parsed.paymentAmount)); }); diff --git a/tests/stake-entry/stake-unstake-reset.test.ts b/tests/stake-entry/stake-unstake-reset.test.ts index 2cc13234..342d3b28 100644 --- a/tests/stake-entry/stake-unstake-reset.test.ts +++ b/tests/stake-entry/stake-unstake-reset.test.ts @@ -1,21 +1,22 @@ import { beforeAll, expect, test } from "@jest/globals"; import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token"; -import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import * as tokenMetadatV1 from "mpl-token-metadata-v1"; +import { + Keypair, + PublicKey, + SystemProgram, + Transaction, +} from "@solana/web3.js"; import { + fetchIdlAccount, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, unstake, } from "../../sdk"; -import { - createInitEntryInstruction, - createInitPoolInstruction, - StakeEntry, - StakePool, -} from "../../sdk/generated"; +import { findMintMetadataId } from "../../sdk/utils"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -44,65 +45,71 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: true, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: true, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.resetOnUnstake).toBe(true); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Init entry", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); - const metadataId = await tokenMetadatV1.Metadata.getPDA(mintId); + const metadataId = findMintMetadataId(mintId); const stakePoolId = findStakePoolId(stakePoolIdentifier); const stakeEntryId = findStakeEntryId(stakePoolId, mintId); - tx.add( - createInitEntryInstruction( - { - stakeEntry: stakeEntryId, - stakePool: stakePoolId, - stakeMint: mintId, - stakeMintMetadata: metadataId, - payer: provider.wallet.publicKey, - }, - { - user: provider.wallet.publicKey, - } - ) - ); + const ix = await program.methods + .initEntry(provider.wallet.publicKey) + .accounts({ + stakeEntry: stakeEntryId, + stakePool: stakePoolId, + stakeMint: mintId, + stakeMintMetadata: metadataId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); }); test("Stake", async () => { @@ -119,18 +126,19 @@ test("Stake", async () => { ]), provider.wallet ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); @@ -153,19 +161,20 @@ test("Unstake", async () => { ]), provider.wallet ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe(PublicKey.default.toString()); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe(PublicKey.default.toString()); + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBe(0); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBe(0); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(false); expect(parseInt(userAta.amount.toString())).toBe(1); diff --git a/tests/stake-entry/stake-unstake.test.ts b/tests/stake-entry/stake-unstake.test.ts index ff84744e..0e5c2edf 100644 --- a/tests/stake-entry/stake-unstake.test.ts +++ b/tests/stake-entry/stake-unstake.test.ts @@ -1,19 +1,21 @@ import { beforeAll, expect, test } from "@jest/globals"; import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token"; -import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; +import { + Keypair, + PublicKey, + SystemProgram, + Transaction, +} from "@solana/web3.js"; import { + fetchIdlAccount, findStakeEntryId, findStakePoolId, + rewardsCenterProgram, SOL_PAYMENT_INFO, stake, unstake, } from "../../sdk"; -import { - createInitPoolInstruction, - StakeEntry, - StakePool, -} from "../../sdk/generated"; import type { CardinalProvider } from "../utils"; import { createMasterEditionTx, @@ -42,41 +44,47 @@ beforeAll(async () => { }); test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() + ); + expect(pool.parsed.requiresAuthorization).toBe(false); + expect(pool.parsed.stakePaymentInfo.toString()).toBe( + SOL_PAYMENT_INFO.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); }); test("Stake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await executeTransactions( provider.connection, await stake(provider.connection, provider.wallet, stakePoolIdentifier, [ @@ -91,27 +99,33 @@ test("Stake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe( provider.wallet.publicKey.toString() ); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(true); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(1); }); @@ -129,6 +143,7 @@ test("Stake again fail", async () => { }); test("Unstake", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); await new Promise((r) => setTimeout(r, 2000)); await executeTransactions( provider.connection, @@ -144,25 +159,33 @@ test("Unstake", async () => { mintId, provider.wallet.publicKey ); - const entry = await StakeEntry.fromAccountAddress( + const entry = await fetchIdlAccount( provider.connection, - stakeEntryId + stakeEntryId, + "stakeEntry" ); - expect(entry.stakeMint.toString()).toBe(mintId.toString()); - expect(entry.lastStaker.toString()).toBe(PublicKey.default.toString()); - expect(parseInt(entry.lastStakedAt.toString())).toBeGreaterThan( + expect(entry.parsed.stakeMint.toString()).toBe(mintId.toString()); + expect(entry.parsed.lastStaker.toString()).toBe(PublicKey.default.toString()); + expect(parseInt(entry.parsed.lastStakedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.lastUpdatedAt.toString())).toBeGreaterThan( + expect(parseInt(entry.parsed.lastUpdatedAt.toString())).toBeGreaterThan( Date.now() / 1000 - 60 ); - expect(parseInt(entry.totalStakeSeconds.toString())).toBeGreaterThan(1); + expect(parseInt(entry.parsed.totalStakeSeconds.toString())).toBeGreaterThan( + 1 + ); const userAta = await getAccount(provider.connection, userAtaId); expect(userAta.isFrozen).toBe(false); expect(parseInt(userAta.amount.toString())).toBe(1); - const activeStakeEntries = await StakeEntry.gpaBuilder() - .addFilter("lastStaker", provider.wallet.publicKey) - .run(provider.connection); + const activeStakeEntries = await program.account.stakeEntry.all([ + { + memcmp: { + offset: 82, + bytes: provider.wallet.publicKey.toString(), + }, + }, + ]); expect(activeStakeEntries.length).toBe(0); }); diff --git a/tests/stake-pool/init-update-stake-pool.test.ts b/tests/stake-pool/init-update-stake-pool.test.ts index 8ea0328c..f04406e6 100644 --- a/tests/stake-pool/init-update-stake-pool.test.ts +++ b/tests/stake-pool/init-update-stake-pool.test.ts @@ -1,12 +1,12 @@ import { beforeAll, expect, test } from "@jest/globals"; -import { Transaction } from "@solana/web3.js"; +import { SystemProgram, Transaction } from "@solana/web3.js"; -import { findStakePoolId, SOL_PAYMENT_INFO } from "../../sdk"; import { - createInitPoolInstruction, - createUpdatePoolInstruction, - StakePool, -} from "../../sdk/generated"; + fetchIdlAccount, + findStakePoolId, + rewardsCenterProgram, + SOL_PAYMENT_INFO, +} from "../../sdk"; import type { CardinalProvider } from "../utils"; import { executeTransaction, getProvider } from "../utils"; @@ -16,72 +16,75 @@ beforeAll(async () => { provider = await getProvider(); }); -test("Init", async () => { +test("Init pool", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createInitPoolInstruction( - { - stakePool: stakePoolId, - payer: provider.wallet.publicKey, - }, - { - ix: { - identifier: stakePoolIdentifier, - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: false, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: provider.wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(false); + expect(pool.parsed.requiresAuthorization).toBe(false); }); test("Update", async () => { + const program = rewardsCenterProgram(provider.connection, provider.wallet); const tx = new Transaction(); const stakePoolId = findStakePoolId(stakePoolIdentifier); - tx.add( - createUpdatePoolInstruction( - { - stakePool: stakePoolId, - authority: provider.wallet.publicKey, - payer: provider.wallet.publicKey, - }, - { - ix: { - allowedCollections: [], - allowedCreators: [], - requiresAuthorization: true, - authority: provider.wallet.publicKey, - resetOnUnstake: false, - cooldownSeconds: null, - minStakeSeconds: null, - endDate: null, - stakePaymentInfo: SOL_PAYMENT_INFO, - unstakePaymentInfo: SOL_PAYMENT_INFO, - }, - } - ) - ); + const ix = await program.methods + .updatePool({ + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: true, + authority: provider.wallet.publicKey, + resetOnUnstake: false, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + authority: provider.wallet.publicKey, + payer: provider.wallet.publicKey, + }) + .instruction(); + tx.add(ix); await executeTransaction(provider.connection, tx, provider.wallet); - const pool = await StakePool.fromAccountAddress( + const pool = await fetchIdlAccount( provider.connection, - stakePoolId + stakePoolId, + "stakePool" + ); + expect(pool.parsed.authority.toString()).toBe( + provider.wallet.publicKey.toString() ); - expect(pool.authority.toString()).toBe(provider.wallet.publicKey.toString()); - expect(pool.requiresAuthorization).toBe(true); + expect(pool.parsed.requiresAuthorization).toBe(true); }); diff --git a/tests/utils.ts b/tests/utils.ts index 3e8e4559..72c52714 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -21,7 +21,8 @@ import { SystemProgram, Transaction, } from "@solana/web3.js"; -import * as tokenMetadatV1 from "mpl-token-metadata-v1"; + +import { findMintEditionId, findMintMetadataId } from "../sdk/utils"; export async function newAccountWithLamports( connection: Connection, @@ -234,8 +235,8 @@ export const createMasterEditionTx = async ( target = authority ) => { const ata = getAssociatedTokenAddressSync(mintId, target); - const editionId = await tokenMetadatV1.Edition.getPDA(mintId); - const metadataId = await tokenMetadatV1.Metadata.getPDA(mintId); + const editionId = findMintEditionId(mintId); + const metadataId = findMintMetadataId(mintId); return new Transaction().add( SystemProgram.createAccount({ diff --git a/tools/payment/createPaymentInfo.ts b/tools/payment/createPaymentInfo.ts index 4e98e9dd..f1e5e7a1 100644 --- a/tools/payment/createPaymentInfo.ts +++ b/tools/payment/createPaymentInfo.ts @@ -1,9 +1,8 @@ -import type { Wallet } from "@project-serum/anchor"; +import type { BN, Wallet } from "@project-serum/anchor"; import type { Connection } from "@solana/web3.js"; import { PublicKey, Transaction } from "@solana/web3.js"; -import type { InitPaymentInfoIx } from "../../sdk"; -import { createInitPaymentInfoInstruction, findPaymentInfoId } from "../../sdk"; +import { findPaymentInfoId, rewardsCenterProgram } from "../../sdk"; import { executeTransaction } from "../utils"; export const commandName = "createPaymentInfo"; @@ -25,6 +24,14 @@ export const getArgs = (_connection: Connection, wallet: Wallet) => ({ ], }); +export type InitPaymentInfoIx = { + authority: PublicKey; + identifier: string; + paymentAmount: BN; + paymentMint: PublicKey; + paymentShares: PublicKey[]; +}; + export const handler = async ( connection: Connection, wallet: Wallet, @@ -32,11 +39,13 @@ export const handler = async ( ) => { const transaction = new Transaction(); const paymentInfoId = findPaymentInfoId(args.identifier); + const program = rewardsCenterProgram(connection, wallet); + transaction.add( - createInitPaymentInfoInstruction( - { paymentInfo: paymentInfoId, payer: wallet.publicKey }, - { ix: args } - ) + await program.methods + .initPaymentInfo(args) + .accounts({ paymentInfo: paymentInfoId, payer: wallet.publicKey }) + .instruction() ); await new Promise((r) => setTimeout(r, 200)); await executeTransaction(connection, transaction, wallet); diff --git a/tools/stake-pool/createStakePool.ts b/tools/stake-pool/createStakePool.ts new file mode 100644 index 00000000..5e385443 --- /dev/null +++ b/tools/stake-pool/createStakePool.ts @@ -0,0 +1,77 @@ +import { utils, Wallet } from "@project-serum/anchor"; +import type { Cluster, PublicKey } from "@solana/web3.js"; +import { Keypair, SystemProgram, Transaction } from "@solana/web3.js"; +import dotenv from "dotenv"; + +import { + findStakePoolId, + rewardsCenterProgram, + SOL_PAYMENT_INFO, +} from "../../sdk"; +import { connectionFor } from "../../tests/utils"; +import { executeTransaction } from "../utils"; + +dotenv.config(); + +export type MarketplaceParams = { + name: string; + paymentManagerName: string; + paymentMints?: PublicKey[]; +}; + +const wallet = Keypair.fromSecretKey( + utils.bytes.bs58.decode(process.env.WALLET || "") +); // your wallet's secret key +const stakePoolIdentifier = `test-name`; + +const main = async (cluster: Cluster) => { + const connection = connectionFor(cluster); + const program = rewardsCenterProgram(connection, new Wallet(wallet)); + const transaction = new Transaction(); + + const stakePoolId = findStakePoolId(stakePoolIdentifier); + const ix = await program.methods + .initPool({ + identifier: stakePoolIdentifier, + allowedCollections: [], + allowedCreators: [], + requiresAuthorization: false, + authority: wallet.publicKey, + resetOnUnstake: true, + cooldownSeconds: null, + minStakeSeconds: null, + endDate: null, + stakePaymentInfo: SOL_PAYMENT_INFO, + unstakePaymentInfo: SOL_PAYMENT_INFO, + }) + .accounts({ + stakePool: stakePoolId, + payer: wallet.publicKey, + systemProgram: SystemProgram.programId, + }) + .instruction(); + transaction.add(ix); + + let txid = ""; + try { + txid = await executeTransaction( + connection, + transaction, + new Wallet(wallet) + ); + } catch (e) { + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + console.log(`Transactionn failed: ${e}`); + } + + try { + await program.account.stakePool.fetch(stakePoolId); + console.log( + `Creted marketplace successfully https://explorer.solana.com/tx/${txid}?cluster=${cluster}.` + ); + } catch (e) { + console.log("Could not create marketplace successfully."); + } +}; + +main("devnet").catch((e) => console.log(e)); diff --git a/yarn.lock b/yarn.lock index eb6a5bd3..86d2fda0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,37 +18,37 @@ "@babel/highlight" "^7.18.6" "@babel/compat-data@^7.20.0": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.1.tgz#f2e6ef7790d8c8dbf03d379502dcc246dcce0b30" - integrity sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.5.tgz#86f172690b093373a933223b4745deeb6049e733" + integrity sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g== "@babel/core@^7.11.6", "@babel/core@^7.12.3": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.2.tgz#8dc9b1620a673f92d3624bd926dc49a52cf25b92" - integrity sha512-w7DbG8DtMrJcFOi4VrLm+8QM4az8Mo+PuLBKLp2zrYRCow8W/f9xiXm5sN53C8HksCyDQwCKha9JiDoIyPjT2g== + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.5.tgz#45e2114dc6cd4ab167f81daf7820e8fa1250d113" + integrity sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.2" + "@babel/generator" "^7.20.5" "@babel/helper-compilation-targets" "^7.20.0" "@babel/helper-module-transforms" "^7.20.2" - "@babel/helpers" "^7.20.1" - "@babel/parser" "^7.20.2" + "@babel/helpers" "^7.20.5" + "@babel/parser" "^7.20.5" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.1" - "@babel/types" "^7.20.2" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.1" semver "^6.3.0" -"@babel/generator@^7.20.1", "@babel/generator@^7.20.2", "@babel/generator@^7.7.2": - version "7.20.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.4.tgz#4d9f8f0c30be75fd90a0562099a26e5839602ab8" - integrity sha512-luCf7yk/cm7yab6CAW1aiFnmEfBJplb/JojV56MYEK7ziWfGmFlTfmL9Ehwfy4gFhbjBfWO1wj7/TuSbVNEEtA== +"@babel/generator@^7.20.5", "@babel/generator@^7.7.2": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.5.tgz#cb25abee3178adf58d6814b68517c62bdbfdda95" + integrity sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA== dependencies: - "@babel/types" "^7.20.2" + "@babel/types" "^7.20.5" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -137,14 +137,14 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== -"@babel/helpers@^7.20.1": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.1.tgz#2ab7a0fcb0a03b5bf76629196ed63c2d7311f4c9" - integrity sha512-J77mUVaDTUJFZ5BpP6mMn6OIl3rEWymk2ZxDBQJUG3P+PbmyMcF3bYWvz0ma69Af1oobDqT/iAsvzhB58xhQUg== +"@babel/helpers@^7.20.5": + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.6.tgz#e64778046b70e04779dfbdf924e7ebb45992c763" + integrity sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w== dependencies: "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.1" - "@babel/types" "^7.20.0" + "@babel/traverse" "^7.20.5" + "@babel/types" "^7.20.5" "@babel/highlight@^7.18.6": version "7.18.6" @@ -155,15 +155,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.1", "@babel/parser@^7.20.2": - version "7.20.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.3.tgz#5358cf62e380cf69efcb87a7bb922ff88bfac6e2" - integrity sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg== - -"@babel/parser@^7.18.10": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.0.tgz#b26133c888da4d79b0d3edcf42677bcadc783046" - integrity sha512-G9VgAhEaICnz8iiJeGJQyVl6J2nTjbW0xeisva0PK6XcKsga7BIaqm4ZF8Rg1Wbaqmy6znspNqhPaPkyukujzg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8" + integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -264,19 +259,19 @@ "@babel/helper-plugin-utils" "^7.19.0" "@babel/runtime-corejs3@^7.10.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.0.tgz#56ef7af3cd23d1570969809a5a8782e774e0141a" - integrity sha512-v1JH7PeAAGBEyTQM9TqojVl+b20zXtesFKCJHu50xMxZKD1fX0TKaKHPsZfFkXfs7D1M9M6Eeqg1FkJ3a0x2dA== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.20.6.tgz#63dae945963539ab0ad578efbf3eff271e7067ae" + integrity sha512-tqeujPiuEfcH067mx+7otTQWROVMKHXEaOQcAeNV5dDdbPWvPcFA8/W9LXw2NfjNmOetqLl03dfnG2WALPlsRQ== dependencies: core-js-pure "^3.25.1" - regenerator-runtime "^0.13.10" + regenerator-runtime "^0.13.11" "@babel/runtime@^7.10.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.9": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.0.tgz#824a9ef325ffde6f78056059db3168c08785e24a" - integrity sha512-NDYdls71fTXoU8TZHfbBWg7DiZfNzClcKui/+kyi6ppD2L1qnWW3VV6CjtaBXSUGGhiTWJ6ereOIkUvenif66Q== + version "7.20.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.6.tgz#facf4879bfed9b5326326273a64220f099b0fce3" + integrity sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA== dependencies: - regenerator-runtime "^0.13.10" + regenerator-runtime "^0.13.11" "@babel/template@^7.18.10", "@babel/template@^7.3.3": version "7.18.10" @@ -287,35 +282,26 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.20.1", "@babel/traverse@^7.7.2": - version "7.20.1" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.1.tgz#9b15ccbf882f6d107eeeecf263fbcdd208777ec8" - integrity sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA== +"@babel/traverse@^7.20.1", "@babel/traverse@^7.20.5", "@babel/traverse@^7.7.2": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.5.tgz#78eb244bea8270fdda1ef9af22a5d5e5b7e57133" + integrity sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.20.1" + "@babel/generator" "^7.20.5" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.19.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.20.1" - "@babel/types" "^7.20.0" + "@babel/parser" "^7.20.5" + "@babel/types" "^7.20.5" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.2.tgz#67ac09266606190f496322dbaff360fdaa5e7842" - integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== - dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" - to-fast-properties "^2.0.0" - -"@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.0.tgz#52c94cf8a7e24e89d2a194c25c35b17a64871479" - integrity sha512-Jlgt3H0TajCW164wkTOTzHkZb075tMQMULzrLUoUeKmO7eFL96GgDxf7/Axhc5CAuKE3KFyVW1p6ysKsi2oXAg== +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.19.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.5.tgz#e206ae370b5393d94dfd1d04cd687cace53efa84" + integrity sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg== dependencies: "@babel/helper-string-parser" "^7.19.4" "@babel/helper-validator-identifier" "^7.19.1" @@ -626,16 +612,6 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@metaplex-foundation/beet-solana@^0.3.0": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz#4b37cda5c7f32ffd2bdd8b3164edc05c6463ab35" - integrity sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g== - dependencies: - "@metaplex-foundation/beet" ">=0.1.0" - "@solana/web3.js" "^1.56.2" - bs58 "^5.0.0" - debug "^4.3.4" - "@metaplex-foundation/beet-solana@^0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.4.0.tgz#52891e78674aaa54e0031f1bca5bfbc40de12e8d" @@ -655,42 +631,25 @@ bn.js "^5.2.0" debug "^4.3.3" -"@metaplex-foundation/beet@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet/-/beet-0.4.0.tgz#eb2a0a6eb084bb25d67dd9bed2f7387ee7e63a55" - integrity sha512-2OAKJnLatCc3mBXNL0QmWVQKAWK2C7XDfepgL0p/9+8oSx4bmRAFHFqptl1A/C0U5O3dxGwKfmKluW161OVGcA== - dependencies: - ansicolors "^0.3.2" - bn.js "^5.2.0" - debug "^4.3.3" - "@metaplex-foundation/cusper@^0.0.2": version "0.0.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz#dc2032a452d6c269e25f016aa4dd63600e2af975" integrity sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA== -"@metaplex-foundation/mpl-core@^0.0.2": - version "0.0.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-core/-/mpl-core-0.0.2.tgz#17ee2cc216e17629d6df1dbba75964625ebbd603" - integrity sha512-UUJ4BlYiWdDegAWmjsNQiNehwYU3QfSFWs3sv4VX0J6/ZrQ28zqosGhQ+I2ZCTEy216finJ82sZWNjuwSWCYyQ== - dependencies: - "@solana/web3.js" "^1.31.0" - bs58 "^4.0.1" - "@metaplex-foundation/mpl-token-metadata@^2.5.1": - version "2.5.1" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.5.1.tgz#0958d49136a102da299de5b2b2b73831196f7593" - integrity sha512-n04kZNKowfjRRXGyOxL8CSyXRBdwP2VZsV3WH90DebzKx201ta8QfchpJmMIqcrgFH4GQtcRM7R/5tQRAHWKow== + version "2.5.2" + resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.5.2.tgz#ec84464e2bf65bf491abdc71c3882e5973dd9978" + integrity sha512-lAjQjj2gGtyLq8MOkp4tWZSC5DK9NWgPd3EoH0KQ9gMs3sKIJRik0CBaZg+JA0uLwzkiErY2Izus4vbWtRADJQ== dependencies: "@metaplex-foundation/beet" "^0.7.1" "@metaplex-foundation/beet-solana" "^0.4.0" "@metaplex-foundation/cusper" "^0.0.2" - "@solana/spl-token" "^0.2.0" - "@solana/web3.js" "^1.35.1" + "@solana/spl-token" "^0.3.6" + "@solana/web3.js" "^1.66.2" bn.js "^5.2.0" - debug "^4.3.3" + debug "^4.3.4" -"@metaplex-foundation/rustbin@^0.3.0", "@metaplex-foundation/rustbin@^0.3.1": +"@metaplex-foundation/rustbin@^0.3.1": version "0.3.1" resolved "https://registry.yarnpkg.com/@metaplex-foundation/rustbin/-/rustbin-0.3.1.tgz#bbcd61e8699b73c0b062728c6f5e8d52e8145042" integrity sha512-hWd2JPrnt2/nJzkBpZD3Y6ZfCUlJujv2K7qUfsxdS0jSwLrSrOvYwmNWFw6mc3lbULj6VP4WDyuy9W5/CHU/lQ== @@ -700,22 +659,6 @@ text-table "^0.2.0" toml "^3.0.0" -"@metaplex-foundation/solita@^0.12.2": - version "0.12.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/solita/-/solita-0.12.2.tgz#13ef213ac183c986f6d01c5d981c44e59a900834" - integrity sha512-oczMfE43NNHWweSqhXPTkQBUbap/aAiwjDQw8zLKNnd/J8sXr/0+rKcN5yJIEgcHeKRkp90eTqkmt2WepQc8yw== - dependencies: - "@metaplex-foundation/beet" "^0.4.0" - "@metaplex-foundation/beet-solana" "^0.3.0" - "@metaplex-foundation/rustbin" "^0.3.0" - "@solana/web3.js" "^1.36.0" - camelcase "^6.2.1" - debug "^4.3.3" - js-sha256 "^0.9.0" - prettier "^2.5.1" - snake-case "^3.0.4" - spok "^1.4.3" - "@noble/ed25519@^1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.1.tgz#6899660f6fbb97798a6fbd227227c4589a454724" @@ -812,9 +755,9 @@ integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA== "@sinonjs/commons@^1.7.0": - version "1.8.5" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.5.tgz#e280c94c95f206dcfd5aca00a43f2156b758c764" - integrity sha512-rTpCA0wG1wUxglBSFdMMY0oTrKYvgf4fNgv/sXbfCVAdf+FnPBdKJR/7XbpTCwbCrvCbdPYnlWaUUYz4V2fPDA== + version "1.8.6" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" + integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== dependencies: type-detect "4.0.8" @@ -842,7 +785,7 @@ dependencies: buffer "~6.0.3" -"@solana/spl-token@=0.3.6", "@solana/spl-token@^0.1.8", "@solana/spl-token@^0.2.0", "@solana/spl-token@^0.3.5": +"@solana/spl-token@=0.3.6", "@solana/spl-token@^0.3.5", "@solana/spl-token@^0.3.6": version "0.3.6" resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.6.tgz#35473ad2ed71fe91e5754a2ac72901e1b8b26a42" integrity sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g== @@ -851,10 +794,10 @@ "@solana/buffer-layout-utils" "^0.2.0" buffer "^6.0.3" -"@solana/web3.js@^1.31.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.35.1", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.66.2": - version "1.66.2" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.66.2.tgz#80b43c5868b846124fe3ebac7d3943930c3fa60c" - integrity sha512-RyaHMR2jGmaesnYP045VLeBGfR/gAW3cvZHzMFGg7bkO+WOYOYp1nEllf0/la4U4qsYGKCsO9eEevR5fhHiVHg== +"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.66.2": + version "1.67.2" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.67.2.tgz#6832139fb906ff2fb13390a81afab04d35b8aa0c" + integrity sha512-qfdV0m/qcTpoJsIwonvXJQz8YY5mrSfBVLS/Cp+MPaaUzDzkpSV7WU1QeHsj+dkHX82W37zuhhg/DadRJls7+g== dependencies: "@babel/runtime" "^7.12.5" "@noble/ed25519" "^1.7.0" @@ -899,9 +842,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.18.2" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.2.tgz#235bf339d17185bdec25e024ca19cce257cc7309" - integrity sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg== + version "7.18.3" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.3.tgz#dfc508a85781e5698d5b33443416b6268c4b3e8d" + integrity sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w== dependencies: "@babel/types" "^7.3.0" @@ -946,9 +889,9 @@ "@types/istanbul-lib-report" "*" "@types/jest@^29.2.0": - version "29.2.2" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.2.2.tgz#874e7dc6702fa6a3fe6107792aa98636dcc480b4" - integrity sha512-og1wAmdxKoS71K2ZwSVqWPX6OVn3ihZ6ZT2qvZvZQm90lJVDyXIjYcu4Khx2CNIeaFv12rOU/YObOsI3VOkzog== + version "29.2.3" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.2.3.tgz#f5fd88e43e5a9e4221ca361e23790d48fcf0a211" + integrity sha512-6XwoEbmatfyoCjWRX7z0fKMmgYKe9+/HrviJ5k0X/tjJWHGAezZOfYaxqQKuzG/TvQyr+ktjm4jgbk0s4/oF2w== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -969,9 +912,9 @@ integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== "@types/node@*": - version "18.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.7.tgz#8ccef136f240770c1379d50100796a6952f01f94" - integrity sha512-LhFTglglr63mNXUSRYD8A+ZAIu5sFqNJ4Y2fPuY7UlrySJH87rRRlhtVmMHplmfk5WkoJGmDjE9oiTfyX94CpQ== + version "18.11.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" + integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== "@types/node@^12.12.54": version "12.20.55" @@ -1006,20 +949,20 @@ integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^17.0.13", "@types/yargs@^17.0.8": - version "17.0.13" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.13.tgz#34cced675ca1b1d51fcf4d34c3c6f0fa142a5c76" - integrity sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg== + version "17.0.15" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.15.tgz#5b62c89fb049e2fc8378394a2861a593055f0866" + integrity sha512-ZHc4W2dnEQPfhn06TBEdWaiUHEZAocYaiVMfwOipY5jcJt/251wVrKCBWBetGZWO5CF8tdb7L3DmdxVlZ2BOIg== dependencies: "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^5.1.0": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.42.1.tgz#696b9cc21dfd4749c1c8ad1307f76a36a00aa0e3" - integrity sha512-LyR6x784JCiJ1j6sH5Y0K6cdExqCCm8DJUTcwG5ThNXJj/G8o5E56u5EdG4SLy+bZAwZBswC+GYn3eGdttBVCg== + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.45.0.tgz#ffa505cf961d4844d38cfa19dcec4973a6039e41" + integrity sha512-CXXHNlf0oL+Yg021cxgOdMHNTXD17rHkq7iW6RFHoybdFgQBjU3yIXhhcPpGwr1CjZlo6ET8C6tzX5juQoXeGA== dependencies: - "@typescript-eslint/scope-manager" "5.42.1" - "@typescript-eslint/type-utils" "5.42.1" - "@typescript-eslint/utils" "5.42.1" + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/type-utils" "5.45.0" + "@typescript-eslint/utils" "5.45.0" debug "^4.3.4" ignore "^5.2.0" natural-compare-lite "^1.4.0" @@ -1028,78 +971,78 @@ tsutils "^3.21.0" "@typescript-eslint/experimental-utils@^5.0.0": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.42.1.tgz#755695d8f1b45dff7b5626cb48f33542227a3471" - integrity sha512-qona75z2MLpeZADEuCet5Pwvh1g/0cWScEEDy43chuUPc4klgDiwz5hLFk5dHcjFEETSYQHRPYiiHKW24EMPjw== + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.45.0.tgz#b59fea61a855cb2b1fdbd0fb45934a844f4bf870" + integrity sha512-DnRQg5+3uHHt/gaifTjwg9OKbg9/TWehfJzYHQIDJboPEbF897BKDE/qoqMhW7nf0jWRV1mwVXTaUvtB1/9Gwg== dependencies: - "@typescript-eslint/utils" "5.42.1" + "@typescript-eslint/utils" "5.45.0" "@typescript-eslint/parser@^5.1.0": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.42.1.tgz#3e66156f2f74b11690b45950d8f5f28a62751d35" - integrity sha512-kAV+NiNBWVQDY9gDJDToTE/NO8BHi4f6b7zTsVAJoTkmB/zlfOpiEVBzHOKtlgTndCKe8vj9F/PuolemZSh50Q== + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.45.0.tgz#b18a5f6b3cf1c2b3e399e9d2df4be40d6b0ddd0e" + integrity sha512-brvs/WSM4fKUmF5Ot/gEve6qYiCMjm6w4HkHPfS6ZNmxTS0m0iNN4yOChImaCkqc1hRwFGqUyanMXuGal6oyyQ== dependencies: - "@typescript-eslint/scope-manager" "5.42.1" - "@typescript-eslint/types" "5.42.1" - "@typescript-eslint/typescript-estree" "5.42.1" + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/typescript-estree" "5.45.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.42.1.tgz#05e5e1351485637d466464237e5259b49f609b18" - integrity sha512-QAZY/CBP1Emx4rzxurgqj3rUinfsh/6mvuKbLNMfJMMKYLRBfweus8brgXF8f64ABkIZ3zdj2/rYYtF8eiuksQ== +"@typescript-eslint/scope-manager@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.45.0.tgz#7a4ac1bfa9544bff3f620ab85947945938319a96" + integrity sha512-noDMjr87Arp/PuVrtvN3dXiJstQR1+XlQ4R1EvzG+NMgXi8CuMCXpb8JqNtFHKceVSQ985BZhfRdowJzbv4yKw== dependencies: - "@typescript-eslint/types" "5.42.1" - "@typescript-eslint/visitor-keys" "5.42.1" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/visitor-keys" "5.45.0" -"@typescript-eslint/type-utils@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.42.1.tgz#21328feb2d4b193c5852b35aabd241ccc1449daa" - integrity sha512-WWiMChneex5w4xPIX56SSnQQo0tEOy5ZV2dqmj8Z371LJ0E+aymWD25JQ/l4FOuuX+Q49A7pzh/CGIQflxMVXg== +"@typescript-eslint/type-utils@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.45.0.tgz#aefbc954c40878fcebeabfb77d20d84a3da3a8b2" + integrity sha512-DY7BXVFSIGRGFZ574hTEyLPRiQIvI/9oGcN8t1A7f6zIs6ftbrU0nhyV26ZW//6f85avkwrLag424n+fkuoJ1Q== dependencies: - "@typescript-eslint/typescript-estree" "5.42.1" - "@typescript-eslint/utils" "5.42.1" + "@typescript-eslint/typescript-estree" "5.45.0" + "@typescript-eslint/utils" "5.45.0" debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/types@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.42.1.tgz#0d4283c30e9b70d2aa2391c36294413de9106df2" - integrity sha512-Qrco9dsFF5lhalz+lLFtxs3ui1/YfC6NdXu+RAGBa8uSfn01cjO7ssCsjIsUs484vny9Xm699FSKwpkCcqwWwA== +"@typescript-eslint/types@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.45.0.tgz#794760b9037ee4154c09549ef5a96599621109c5" + integrity sha512-QQij+u/vgskA66azc9dCmx+rev79PzX8uDHpsqSjEFtfF2gBUTRCpvYMh2gw2ghkJabNkPlSUCimsyBEQZd1DA== -"@typescript-eslint/typescript-estree@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.42.1.tgz#f9a223ecb547a781d37e07a5ac6ba9ff681eaef0" - integrity sha512-qElc0bDOuO0B8wDhhW4mYVgi/LZL+igPwXtV87n69/kYC/7NG3MES0jHxJNCr4EP7kY1XVsRy8C/u3DYeTKQmw== +"@typescript-eslint/typescript-estree@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.45.0.tgz#f70a0d646d7f38c0dfd6936a5e171a77f1e5291d" + integrity sha512-maRhLGSzqUpFcZgXxg1qc/+H0bT36lHK4APhp0AEUVrpSwXiRAomm/JGjSG+kNUio5kAa3uekCYu/47cnGn5EQ== dependencies: - "@typescript-eslint/types" "5.42.1" - "@typescript-eslint/visitor-keys" "5.42.1" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/visitor-keys" "5.45.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.42.1.tgz#2789b1cd990f0c07aaa3e462dbe0f18d736d5071" - integrity sha512-Gxvf12xSp3iYZd/fLqiQRD4uKZjDNR01bQ+j8zvhPjpsZ4HmvEFL/tC4amGNyxN9Rq+iqvpHLhlqx6KTxz9ZyQ== +"@typescript-eslint/utils@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.45.0.tgz#9cca2996eee1b8615485a6918a5c763629c7acf5" + integrity sha512-OUg2JvsVI1oIee/SwiejTot2OxwU8a7UfTFMOdlhD2y+Hl6memUSL4s98bpUTo8EpVEr0lmwlU7JSu/p2QpSvA== dependencies: "@types/json-schema" "^7.0.9" "@types/semver" "^7.3.12" - "@typescript-eslint/scope-manager" "5.42.1" - "@typescript-eslint/types" "5.42.1" - "@typescript-eslint/typescript-estree" "5.42.1" + "@typescript-eslint/scope-manager" "5.45.0" + "@typescript-eslint/types" "5.45.0" + "@typescript-eslint/typescript-estree" "5.45.0" eslint-scope "^5.1.1" eslint-utils "^3.0.0" semver "^7.3.7" -"@typescript-eslint/visitor-keys@5.42.1": - version "5.42.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.42.1.tgz#df10839adf6605e1cdb79174cf21e46df9be4872" - integrity sha512-LOQtSF4z+hejmpUvitPlc4hA7ERGoj2BVkesOcG91HCn8edLGUXbTrErmutmPbl8Bo9HjAvOO/zBKQHExXNA2A== +"@typescript-eslint/visitor-keys@5.45.0": + version "5.45.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.45.0.tgz#e0d160e9e7fdb7f8da697a5b78e7a14a22a70528" + integrity sha512-jc6Eccbn2RtQPr1s7th6jJWQHBHI6GBVQkCHoJFQ5UreaKm59Vxw+ynQUPPY2u2Amquc+7tmEoC2G52ApsGNNg== dependencies: - "@typescript-eslint/types" "5.42.1" + "@typescript-eslint/types" "5.45.0" eslint-visitor-keys "^3.3.0" JSONStream@^1.3.5: @@ -1179,15 +1122,15 @@ ansi-styles@^6.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -ansicolors@^0.3.2, ansicolors@~0.3.2: +ansicolors@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== anymatch@^3.0.3: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" @@ -1218,14 +1161,14 @@ array-differ@^3.0.0: integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== array-includes@^3.1.4, array-includes@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.5.tgz#2c320010db8d31031fd2a5f6b3bbd4b1aad31bdb" - integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== + version "3.1.6" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.6.tgz#9e9e720e194f198266ba9e18c29e6a9b0e4b225f" + integrity sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw== dependencies: call-bind "^1.0.2" define-properties "^1.1.4" - es-abstract "^1.19.5" - get-intrinsic "^1.1.1" + es-abstract "^1.20.4" + get-intrinsic "^1.1.3" is-string "^1.0.7" array-union@^2.1.0: @@ -1234,13 +1177,13 @@ array-union@^2.1.0: integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== array.prototype.flat@^1.2.5: - version "1.3.0" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz#0b0c1567bf57b38b56b4c97b8aa72ab45e4adc7b" - integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw== + version "1.3.1" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz#ffc6576a7ca3efc2f46a143b9d1dda9b4b3cf5e2" + integrity sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.2" + define-properties "^1.1.4" + es-abstract "^1.20.4" es-shim-unscopables "^1.0.0" arrify@^2.0.1: @@ -1259,9 +1202,9 @@ astral-regex@^2.0.0: integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== axe-core@^4.4.3: - version "4.5.0" - resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.5.0.tgz#6efe2ecdba205fcc9d7ddb3d48c2cf630f70eb5e" - integrity sha512-4+rr8eQ7+XXS5nZrKcMO/AikHL0hVqy+lHWAnE3xdHl+aguag8SOQ6eEqLexwLNWgXIMfunGuD3ON1/6Kyet0A== + version "4.5.2" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.5.2.tgz#823fdf491ff717ac3c58a52631d4206930c1d9f7" + integrity sha512-u2MVsXfew5HBvjsczCv+xlwdNnB1oQR9HlAcsejZttNjKKSkeDNVwB1vMThIUIFI9GoT57Vtk8iQLwqOfAkboA== axobject-query@^2.2.0: version "2.2.0" @@ -1494,15 +1437,15 @@ camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0, camelcase@^6.2.1: +camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001400: - version "1.0.30001431" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz#e7c59bd1bc518fae03a4656be442ce6c4887a795" - integrity sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ== + version "1.0.30001435" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001435.tgz#502c93dbd2f493bee73a408fe98e98fb1dad10b2" + integrity sha512-kdCkUTjR+v4YAJelyiDTqiu82BDr4W4CP5sgTA0ZBmqn30XfS2ZghPLMowik9TPhS+psWJiUNxsqLyurDbmutA== chalk@^2.0.0: version "2.4.2" @@ -1535,9 +1478,9 @@ char-regex@^1.0.2: integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== ci-info@^3.2.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.6.1.tgz#7594f1c95cb7fdfddee7af95a13af7dbc67afdcf" - integrity sha512-up5ggbaDqOqJ4UqLKZ2naVkyqSJQgJi5lwD6b6mM748ysrghDBX0bx/qJTUHzw7zu6Mq4gycviSF5hJnwceD8w== + version "3.7.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.7.0.tgz#6d01b3696c59915b6ce057e4aa4adfc2fa25f5ef" + integrity sha512-2CpRNYmImPx+RXKLq6jko/L07phmS9I02TyqkcNU20GCF/GgaWvc58hPtjxDX8lPpkdwc9sNh72V9k00S7ezog== cjs-module-lexer@^1.0.0: version "1.2.2" @@ -1615,7 +1558,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^2.0.16, colorette@^2.0.17: +colorette@^2.0.19: version "2.0.19" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== @@ -1630,7 +1573,7 @@ commander@^2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^9.3.0: +commander@^9.4.1: version "9.4.1" resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== @@ -1651,9 +1594,9 @@ convert-source-map@^2.0.0: integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== core-js-pure@^3.25.1: - version "3.26.0" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.26.0.tgz#7ad8a5dd7d910756f3124374b50026e23265ca9a" - integrity sha512-LiN6fylpVBVwT8twhhluD9TzXmZQQsr2I2eIKtWNbZI1XMfBT7CV18itaN6RA7EtQd/SDdRx/wzvAShX2HvhQA== + version "3.26.1" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.26.1.tgz#653f4d7130c427820dcecd3168b594e8bb095a33" + integrity sha512-VVXcDpp/xJ21KdULRq/lXdLzQAtX7+37LzpyfFM973il0tWSsDEoyzG38G14AjTpK9VTfiNM9jnFauq/CpaWGQ== cross-fetch@^3.1.5: version "3.1.5" @@ -1813,7 +1756,7 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5: +es-abstract@^1.19.0, es-abstract@^1.20.4: version "1.20.4" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.4.tgz#1d103f9f8d78d4cf0713edcd6d0ed1a46eed5861" integrity sha512-0UtvRN79eMe2L+UNEF1BwRe364sj/DXhQ/k5FmivgoSdpM90b8Jc0mDzKMGo7QS0BVbOP/bTwBKNnDc9rNzaPA== @@ -2076,9 +2019,9 @@ eslint-visitor-keys@^3.3.0: integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== eslint@^8.25.0: - version "8.27.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.27.0.tgz#d547e2f7239994ad1faa4bb5d84e5d809db7cf64" - integrity sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ== + version "8.28.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.28.0.tgz#81a680732634677cc890134bcdd9fdfea8e63d6e" + integrity sha512-S27Di+EVyMxcHiwDrFzk8dJYAaD+/5SoWKxL1ri/71CRHsnJnRDPNt2Kzj24+MT9FDupf4aqqyqPrvI8MvQ4VQ== dependencies: "@eslint/eslintrc" "^1.3.3" "@humanwhocodes/config-array" "^0.11.6" @@ -2121,9 +2064,9 @@ eslint@^8.25.0: text-table "^0.2.0" espree@^9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.0.tgz#cd4bc3d6e9336c433265fc0aa016fc1aaf182f8a" - integrity sha512-DQmnRpLj7f6TgN/NYb0MTzJXL+vJF9h3pHy4JhCIs3zwcgez8xmGg3sXHcEO97BrmO2OSvCwMdfdlyl+E9KjOw== + version "9.4.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" + integrity sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg== dependencies: acorn "^8.8.0" acorn-jsx "^5.3.2" @@ -2438,9 +2381,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.15.0: - version "13.17.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.17.0.tgz#902eb1e680a41da93945adbdcb5a9f361ba69bd4" - integrity sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw== + version "13.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.18.0.tgz#fb224daeeb2bb7d254cd2c640f003528b8d0c1dc" + integrity sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A== dependencies: type-fest "^0.20.2" @@ -2533,9 +2476,9 @@ ieee754@^1.2.1: integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== ignore@^5.0.5, ignore@^5.1.4, ignore@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" - integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== + version "5.2.1" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.1.tgz#c2b1f76cb999ede1502f3a226a9310fdfe88d46c" + integrity sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA== import-fresh@^3.0.0, import-fresh@^3.2.1: version "3.3.0" @@ -2976,9 +2919,9 @@ jest-mock@^29.3.1: jest-util "^29.3.1" jest-pnp-resolver@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" - integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== + version "1.2.3" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== jest-regex-util@^29.2.0: version "29.2.0" @@ -3152,9 +3095,9 @@ jest@^29.2.1: jest-cli "^29.3.1" js-sdsl@^4.1.4: - version "4.1.5" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.1.5.tgz#1ff1645e6b4d1b028cd3f862db88c9d887f26e2a" - integrity sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q== + version "4.2.0" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.2.0.tgz#278e98b7bea589b8baaf048c20aeb19eb7ad09d0" + integrity sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ== js-sha256@^0.9.0: version "0.9.0" @@ -3266,10 +3209,10 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -lilconfig@2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.5.tgz#19e57fd06ccc3848fd1891655b5a447092225b25" - integrity sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg== +lilconfig@2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.6.tgz#32a384558bd58af3d4c6e077dd1ad1d397bc69d4" + integrity sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg== lines-and-columns@^1.1.6: version "1.2.4" @@ -3277,35 +3220,35 @@ lines-and-columns@^1.1.6: integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== lint-staged@^13.0.3: - version "13.0.3" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.0.3.tgz#d7cdf03a3830b327a2b63c6aec953d71d9dc48c6" - integrity sha512-9hmrwSCFroTSYLjflGI8Uk+GWAwMB4OlpU4bMJEAT5d/llQwtYKoim4bLOyLCuWFAhWEupE0vkIFqtw/WIsPug== + version "13.0.4" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.0.4.tgz#c4b4391280c35165b805ad43304ba01f733067a0" + integrity sha512-HxlHCXoYRsq9QCby5wFozmZW00hMs/9e3l+/dz6Qr8Kle4UH0kJTdABAbqhzG+3pcG6QjL9kz7NgGBfph+a5dw== dependencies: cli-truncate "^3.1.0" - colorette "^2.0.17" - commander "^9.3.0" + colorette "^2.0.19" + commander "^9.4.1" debug "^4.3.4" execa "^6.1.0" - lilconfig "2.0.5" - listr2 "^4.0.5" + lilconfig "2.0.6" + listr2 "^5.0.5" micromatch "^4.0.5" normalize-path "^3.0.0" object-inspect "^1.12.2" pidtree "^0.6.0" string-argv "^0.3.1" - yaml "^2.1.1" + yaml "^2.1.3" -listr2@^4.0.5: - version "4.0.5" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-4.0.5.tgz#9dcc50221583e8b4c71c43f9c7dfd0ef546b75d5" - integrity sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA== +listr2@^5.0.5: + version "5.0.6" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.6.tgz#3c61153383869ffaad08a8908d63edfde481dff8" + integrity sha512-u60KxKBy1BR2uLJNTWNptzWQ1ob/gjMzIJPZffAENzpZqbMZ/5PrXXOomDcevIS/+IB7s1mmCEtSlT2qHWMqag== dependencies: cli-truncate "^2.1.0" - colorette "^2.0.16" + colorette "^2.0.19" log-update "^4.0.0" p-map "^4.0.0" rfdc "^1.3.0" - rxjs "^7.5.5" + rxjs "^7.5.7" through "^2.3.8" wrap-ansi "^7.0.0" @@ -3407,9 +3350,9 @@ makeerror@1.0.12: tmpl "1.0.5" marked@^4.0.19: - version "4.2.2" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.2.tgz#1d2075ad6cdfe42e651ac221c32d949a26c0672a" - integrity sha512-JjBTFTAvuTgANXx82a5vzK9JLSMoV6V3LBVn4Uhdso6t7vXrGx7g1Cd2r6NYSsxrYbQGFCMqBDhFHyK5q2UvcQ== + version "4.2.3" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.3.tgz#bd76a5eb510ff1d8421bc6c3b2f0b93488c15bea" + integrity sha512-slWRdJkbTZ+PjkyJnE30Uid64eHwbwa1Q25INCAYfZlK4o6ylagBy/Le9eWntqJFoFT93ikUKMv47GZ4gTwHkw== merge-stream@^2.0.0: version "2.0.0" @@ -3447,9 +3390,9 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: brace-expansion "^1.1.7" minimatch@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" - integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + version "5.1.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.1.tgz#6c9dffcf9927ff2a31e74b5af11adf8b9604b022" + integrity sha512-362NP+zlprccbEt/SkxKfRMHnNY85V74mVnpUpNyr3F35covl09Kec7/sEFLt3RA4oXmewtoaanoIf67SE5Y5g== dependencies: brace-expansion "^2.0.1" @@ -3458,15 +3401,6 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== -"mpl-token-metadata-v1@npm:@metaplex-foundation/mpl-token-metadata@1.2.5": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-1.2.5.tgz#1a927b1c7d30cd634a1e4782022712a02f6865c2" - integrity sha512-pxRG53JsTSwXpiJJMHNulJhH8kO3hHztQ3QxslUoKw2hBYKXsg9TGsiHgNIhN2MPZGBJ2pDeK6kNGv0sd54HhA== - dependencies: - "@metaplex-foundation/mpl-core" "^0.0.2" - "@solana/spl-token" "^0.1.8" - "@solana/web3.js" "^1.31.0" - mri@^1.1.5: version "1.2.0" resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" @@ -3578,13 +3512,13 @@ object.assign@^4.1.3, object.assign@^4.1.4: object-keys "^1.1.1" object.values@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" - integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== + version "1.1.6" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.6.tgz#4abbaa71eba47d63589d402856f908243eea9b1d" + integrity sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.20.4" once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" @@ -3660,9 +3594,9 @@ p-try@^2.0.0: integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== pako@^2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/pako/-/pako-2.0.4.tgz#6cebc4bbb0b6c73b0d5b8d7e8476e2b2fbea576d" - integrity sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg== + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== parent-module@^1.0.0: version "1.0.1" @@ -3757,10 +3691,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.2.1, prettier@^2.5.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@^2.2.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.0.tgz#c7df58393c9ba77d6fba3921ae01faf994fb9dc9" + integrity sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA== pretty-format@^29.0.0, pretty-format@^29.3.1: version "29.3.1" @@ -3819,10 +3753,10 @@ readline@^1.3.0: resolved "https://registry.yarnpkg.com/readline/-/readline-1.3.0.tgz#c580d77ef2cfc8752b132498060dc9793a7ac01c" integrity sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg== -regenerator-runtime@^0.13.10: - version "0.13.10" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee" - integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw== +regenerator-runtime@^0.13.11: + version "0.13.11" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" + integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== regexp.prototype.flags@^1.4.3: version "1.4.3" @@ -3919,7 +3853,7 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^7.5.5: +rxjs@^7.5.7: version "7.5.7" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== @@ -4044,13 +3978,6 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -spok@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/spok/-/spok-1.4.3.tgz#8516234e6bd8caf0e10567bd675e15fd03b5ceb8" - integrity sha512-5wFGctwrk638aDs+44u99kohxFNByUq2wo0uShQ9yqxSmsxqx7zKbMo1Busy4s7stZQXU+PhJ/BlVf2XWFEGIw== - dependencies: - ansicolors "~0.3.2" - sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -4095,22 +4022,22 @@ string-width@^5.0.0: strip-ansi "^7.0.1" string.prototype.trimend@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" - integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== + version "1.0.6" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz#c4a27fa026d979d79c04f17397f250a462944533" + integrity sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ== dependencies: call-bind "^1.0.2" define-properties "^1.1.4" - es-abstract "^1.19.5" + es-abstract "^1.20.4" string.prototype.trimstart@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef" - integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== + version "1.0.6" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4" + integrity sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA== dependencies: call-bind "^1.0.2" define-properties "^1.1.4" - es-abstract "^1.19.5" + es-abstract "^1.20.4" strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" @@ -4273,9 +4200,9 @@ tslib@^1.8.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.3, tslib@^2.1.0, tslib@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== tsutils@^3.21.0: version "3.21.0" @@ -4317,9 +4244,9 @@ typedoc@^0.23.20: shiki "^0.11.1" typescript@^4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== + version "4.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" + integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== unbox-primitive@^1.0.2: version "1.0.2" @@ -4368,9 +4295,9 @@ v8-to-istanbul@^9.0.1: convert-source-map "^1.6.0" vscode-oniguruma@^1.6.1: - version "1.6.2" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz#aeb9771a2f1dbfc9083c8a7fdd9cccaa3f386607" - integrity sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA== + version "1.7.0" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== vscode-textmate@^6.0.0: version "6.0.0" @@ -4457,9 +4384,9 @@ ws@^7.4.5: integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== ws@^8.5.0: - version "8.10.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.10.0.tgz#00a28c09dfb76eae4eb45c3b565f771d6951aa51" - integrity sha512-+s49uSmZpvtAsd2h37vIPy1RBusaLawVe8of+GyEPsaJTCMpj/2v8NpeK1SHXjBlQ95lQTmQofOJnFiLoaN3yw== + version "8.11.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" + integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== y18n@^5.0.5: version "5.0.8" @@ -4471,7 +4398,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.1.1: +yaml@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.1.3.tgz#9b3a4c8aff9821b696275c79a8bee8399d945207" integrity sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==