UNPKG

@rainfi/sdk

Version:

This package is used to interact with Rain.fi protocol on Solana

185 lines 5.89 kB
"use strict"; /** * 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 */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBuyNftFromPairInstruction = void 0; const splToken = __importStar(require("@solana/spl-token")); const beet = __importStar(require("@metaplex-foundation/beet")); const web3 = __importStar(require("@solana/web3.js")); const AuthorizationDataLocal_1 = require("../types/AuthorizationDataLocal"); /** * @category Instructions * @category BuyNftFromPair * @category generated */ const buyNftFromPairStruct = new beet.FixableBeetArgsStruct([ ['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)], ['maxAmountToPay', beet.u64], ['skipFailed', beet.bool], ['authorizationData', beet.coption(AuthorizationDataLocal_1.authorizationDataLocalBeet)], ['payRoyalty', beet.bool], ], 'BuyNftFromPairInstructionArgs'); const buyNftFromPairInstructionDiscriminator = [ 101, 169, 144, 156, 29, 237, 168, 192, ]; /** * Creates a _BuyNftFromPair_ 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 BuyNftFromPair * @category generated */ function createBuyNftFromPairInstruction(accounts, args) { const { nftPairBox, pair, user, fundsSolVault, nftsOwner, feeSolVault, nftMint, vaultNftTokenAccount, nftUserTokenAccount, assetReceiver, editionInfo, metadataInfo, ownerTokenRecord, destTokenRecord, instructions, authorizationRulesProgram, protocolFeeReceiver, associatedTokenProgram, metadataProgram, } = accounts; const [data] = buyNftFromPairStruct.serialize(Object.assign({ instructionDiscriminator: buyNftFromPairInstructionDiscriminator }, args)); const keys = [ { pubkey: nftPairBox, isWritable: true, isSigner: false, }, { pubkey: pair, isWritable: true, isSigner: false, }, { pubkey: user, isWritable: true, isSigner: true, }, { pubkey: fundsSolVault, isWritable: true, isSigner: false, }, { pubkey: nftsOwner, isWritable: false, isSigner: false, }, { pubkey: feeSolVault, isWritable: true, isSigner: false, }, { pubkey: nftMint, isWritable: true, isSigner: false, }, { pubkey: vaultNftTokenAccount, isWritable: true, isSigner: false, }, { pubkey: nftUserTokenAccount, isWritable: true, isSigner: false, }, { pubkey: assetReceiver, isWritable: true, isSigner: false, }, { pubkey: editionInfo, isWritable: false, isSigner: false, }, { pubkey: metadataInfo, isWritable: true, isSigner: false, }, { pubkey: ownerTokenRecord, isWritable: true, isSigner: false, }, { pubkey: destTokenRecord, isWritable: true, isSigner: false, }, { pubkey: instructions, isWritable: false, isSigner: false, }, { pubkey: authorizationRulesProgram, isWritable: false, isSigner: false, }, { pubkey: protocolFeeReceiver, isWritable: true, isSigner: false, }, { pubkey: splToken.TOKEN_PROGRAM_ID, isWritable: false, isSigner: false, }, { pubkey: associatedTokenProgram, isWritable: false, isSigner: false, }, { pubkey: web3.SystemProgram.programId, isWritable: false, isSigner: false, }, { pubkey: web3.SYSVAR_RENT_PUBKEY, isWritable: false, isSigner: false, }, { pubkey: metadataProgram, isWritable: false, isSigner: false, }, ]; const ix = new web3.TransactionInstruction({ programId: new web3.PublicKey('hadeK9DLv9eA7ya5KCTqSvSvRZeJC3JgD5a9Y3CNbvu'), keys, data, }); return ix; } exports.createBuyNftFromPairInstruction = createBuyNftFromPairInstruction; //# sourceMappingURL=buyNftFromPair.js.map