Skip to content

Commit

Permalink
Update ATA programId to redeemDrop
Browse files Browse the repository at this point in the history
  • Loading branch information
RustySol committed Oct 8, 2022
1 parent 868b546 commit 90ec506
Show file tree
Hide file tree
Showing 3 changed files with 302 additions and 308 deletions.
18 changes: 13 additions & 5 deletions core/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,21 @@ programCommand('mintPrint')
programCommand('redeemDrop')
.description('mint an edition-ed NFT from the master edition')
.requiredOption('-ota, --nft-owner-token-account <string>', 'NFT token account address')
.requiredOption('-mem, --master-edition-mint <string>', 'NFT master edition mint address')
.requiredOption('-tm, --treasury-mint <string>', 'Candy Shop treasury mint')
.requiredOption('-sc, --shop-creator <string>', 'Candy Shop creator address')
.action(async (name, cmd) => {
let { keypair, env, nftOwnerTokenAccount, treasuryMint, rpcUrl, shopCreator, version, isEnterpriseArg } =
cmd.opts();
let {
keypair,
env,
nftOwnerTokenAccount,
masterEditionMint,
treasuryMint,
rpcUrl,
shopCreator,
version,
isEnterpriseArg
} = cmd.opts();
const wallet = loadKey(keypair);

if (version !== 'v2') {
Expand All @@ -644,12 +654,10 @@ programCommand('redeemDrop')
isEnterprise: isEnterprise(isEnterpriseArg)
});

const tokenAccountInfo = await getAccount(candyShop.connection(), new PublicKey(nftOwnerTokenAccount), 'finalized');

const txHash = await candyShop.redeemDrop({
nftOwner: wallet,
nftOwnerTokenAccount: new PublicKey(nftOwnerTokenAccount),
masterMint: tokenAccountInfo.mint
masterMint: new PublicKey(masterEditionMint)
});

console.log('txHash', txHash);
Expand Down
3 changes: 2 additions & 1 deletion core/sdk/src/factory/program/v2/editionDrop/redeemNft.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { SystemProgram, SYSVAR_RENT_PUBKEY, Transaction } from '@solana/web3.js';
import { checkRedeemable, getAtaForMint, sendTx } from '../../../../vendor';
import { RedeemNftParams } from '../../model';
Expand All @@ -22,6 +22,7 @@ export const redeemNft = async (params: RedeemNftParams) => {
nftMint: masterMint,
systemProgram: SystemProgram.programId,
tokenProgram: TOKEN_PROGRAM_ID,
associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
rent: SYSVAR_RENT_PUBKEY
})
.instruction();
Expand Down
Loading

0 comments on commit 90ec506

Please sign in to comment.