@bbachain/spl-token-swap
Version:
JavaScript/TypeScript bindings for the Solana Program Library (SPL) Token Swap program.
116 lines (115 loc) • 3.83 kB
JavaScript
;
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.createDepositAllTokenTypesInstruction = exports.depositAllTokenTypesInstructionDiscriminator = void 0;
const beet = __importStar(require("@bbachain/beet"));
const web3 = __importStar(require("@bbachain/web3.js"));
const __1 = require("..");
const types_1 = require("../types");
exports.depositAllTokenTypesInstructionDiscriminator = 2;
/**
* Creates a _DepositAllTokenTypes_ 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 DepositAllTokenTypes
*/
function createDepositAllTokenTypesInstruction(accounts, args, programId = new web3.PublicKey(__1.PROGRAM_ADDRESS)) {
const [data] = depositAllTokenTypesInstructionStruct.serialize({
instructionDiscriminator: exports.depositAllTokenTypesInstructionDiscriminator,
...args,
});
const keys = [
{
pubkey: accounts.tokenSwap,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.authority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.userTransferAuthority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.sourceA,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.sourceB,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.intoA,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.intoB,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.poolMint,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.poolAccount,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.tokenProgram,
isWritable: false,
isSigner: false,
},
];
if (accounts.anchorRemainingAccounts != null) {
keys.push(...accounts.anchorRemainingAccounts);
}
const ix = new web3.TransactionInstruction({
programId,
keys,
data,
});
return ix;
}
exports.createDepositAllTokenTypesInstruction = createDepositAllTokenTypesInstruction;
/**
* A union of all instruction structs
*/
const depositAllTokenTypesInstructionStruct = new beet.FixableBeetArgsStruct([
['instructionDiscriminator', beet.u8],
...types_1.depositAllTokenTypesArgsBeet.fields,
], 'DepositAllTokenTypesInstructionArgs');