UNPKG

solmash-whitelist-sdk

Version:

A sdk for interacting Solmash Whitelist program

144 lines 5.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SolmashWhitelistInstructions = void 0; const spl_token_1 = require("@solana/spl-token"); const web3_js_1 = require("@solana/web3.js"); class SolmashWhitelistInstructions { constructor(program) { this.program = program; } async getInitAuctionInstruction(auction, auctionVault, owner, initParams) { const { name, enabled, preSaleStartTime, preSaleEndTime, ticketsInPool, tokenQuantityPerTicket, ticketPriceInSol, ticketPriceInSobb, auctionToken, bidToken, } = initParams; return this.program.methods .initAuction({ auctionToken, bidToken, enabled, name, preSaleEndTime, preSaleStartTime, ticketPriceInSobb, ticketPriceInSol, ticketsInPool, tokenQuantityPerTicket, }) .accounts({ auction, auctionVault, owner, rent: web3_js_1.SYSVAR_RENT_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, }) .instruction(); } async getAddTokenInstruction(auction, auctionToken, auctionVault, auctionVaultTokenAccount, owner, ownerAuctionTokenAccount) { return this.program.methods .addToken() .accounts({ associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, auction, auctionToken, auctionVault, auctionVaultTokenAccount, clock: web3_js_1.SYSVAR_CLOCK_PUBKEY, owner, ownerAuctionTokenAccount, rent: web3_js_1.SYSVAR_RENT_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, }) .instruction(); } async getWithdrawFundsInstruction(auction, auctionBidTokenAccount, auctionToken, auctionVault, auctionVaultTokenAccount, bidToken, creator, creatorAuctionTokenAccount, creatorBidTokenAccount) { return this.program.methods .withdrawFunds() .accounts({ auction, auctionBidTokenAccount, auctionToken, auctionVault, auctionVaultTokenAccount, bidToken, clock: web3_js_1.SYSVAR_CLOCK_PUBKEY, creator, creatorAuctionTokenAccount, creatorBidTokenAccount, systemProgram: web3_js_1.SystemProgram.programId, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, }) .instruction(); } async getWhitelistInstruction(auction, buyerPda, creator, whitelistUser) { return this.program.methods .whitelist() .accounts({ auction, buyerPda, creator, rent: web3_js_1.SYSVAR_RENT_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, whitelistUser, }) .instruction(); } async getPreSaleBuyUsingSplInstruction(auction, auctionVault, auctionVaultBidTokenAccount, bidToken, buyer, buyerBidTokenAccount, buyerPda) { return this.program.methods .preSaleBuyUsingSpl() .accounts({ associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, auction, auctionVault, auctionVaultBidTokenAccount, bidToken, buyer, buyerBidTokenAccount, buyerPda, clock: web3_js_1.SYSVAR_CLOCK_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, }) .instruction(); } async getPreSaleBuyUsingSolInstruction(auction, auctionVault, buyer, buyerPda) { return this.program.methods .preSaleBuyUsingSol() .accounts({ auction, auctionVault, buyer, buyerPda, clock: web3_js_1.SYSVAR_CLOCK_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, }) .instruction(); } async getClaimTokensInstruction(auction, auctionToken, auctionVault, auctionVaultTokenAccount, buyer, buyerAuctionTokenAccount, buyerPda) { return this.program.methods .claimTokens() .accounts({ associatedTokenProgram: spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, auction, auctionToken, auctionVault, auctionVaultTokenAccount, buyer, buyerAuctionTokenAccount, buyerPda, clock: web3_js_1.SYSVAR_CLOCK_PUBKEY, systemProgram: web3_js_1.SystemProgram.programId, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, }) .instruction(); } async getChangeTimeInstruction(auction, creator, newStartTime, newEndTime) { return this.program.methods .changeTime(newStartTime, newEndTime) .accounts({ auction, creator, }) .instruction(); } } exports.SolmashWhitelistInstructions = SolmashWhitelistInstructions; //# sourceMappingURL=instructions.js.map