@perena/numeraire-sdk
Version:
Perena’s multi-asset stablecoin pool is a novel automated market maker (AMM) that enables seamless creation and swapping of stablecoins while optimizing liquidity and enhancing efficiency across markets
2,224 lines (2,221 loc) • 97.8 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __pow = Math.pow;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/index.ts
var index_exports = {};
__export(index_exports, {
DEFAULT_PUBLIC_KEY: () => DEFAULT_PUBLIC_KEY,
ID: () => ID,
LIQUIDITY_SEED: () => LIQUIDITY_SEED,
LP_TOKEN_PROGRAM: () => LP_TOKEN_PROGRAM,
MAX_STABLES_PER_POOL: () => MAX_STABLES_PER_POOL,
NORMALIZED_VALUE_DECIMALS: () => NORMALIZED_VALUE_DECIMALS,
NUMERAIRE_CONFIG_ID: () => NUMERAIRE_CONFIG_ID,
NumeraireIDL: () => numeraire_default,
PRODUCTION_POOLS: () => PRODUCTION_POOLS,
STAGING_POOLS: () => STAGING_POOLS,
USE_ENTIRE_IN_ACCOUNT_AMOUNT: () => USE_ENTIRE_IN_ACCOUNT_AMOUNT,
addLiquidity: () => addLiquidity,
buildOptimalTransaction: () => buildOptimalTransaction,
compound: () => compound,
createATAsForPoolsIfNeeded: () => createATAsForPoolsIfNeeded,
createPair: () => createPair,
createPool: () => createPool,
decodeReturnData: () => decodeReturnData,
f64ToU64_LittleEndian: () => f64ToU64_LittleEndian,
getAnchorEventsFromLogs: () => getAnchorEventsFromLogs,
getLiqAccounts: () => getLiqAccounts,
getNumeraireConfig: () => getNumeraireConfig,
getPairState: () => getPairState,
getPoolKeys: () => getPoolKeys,
getPoolState: () => getPoolState,
init: () => init,
loadKeypairFromFile: () => loadKeypairFromFile,
multiSigAddress: () => multiSigAddress,
readOnly: () => readOnly,
removeAllLiquidity: () => removeAllLiquidity,
removeLiquidity: () => removeLiquidity,
setLpTokenMetadata: () => setLpTokenMetadata,
setNumeraireOwner: () => setNumeraireOwner,
setNumeraireStatus: () => setNumeraireStatus,
setNumeraireWhitelistedPoolCreator: () => setNumeraireWhitelistedPoolCreator,
setOwner: () => setOwner,
setPoolStatus: () => setPoolStatus,
setRate: () => setRate,
setRateAsWPC: () => setRateAsWPC,
setWhitelistedAdder: () => setWhitelistedAdder,
state: () => state,
swapExactIn: () => swapExactIn,
swapExactInOptimalCUTransaction: () => swapExactInOptimalCUTransaction,
u64ToF64_LittleEndian: () => u64ToF64_LittleEndian
});
module.exports = __toCommonJS(index_exports);
// src/idl/numeraire.json
var numeraire_default = {
address: "NUMERUNsFCP3kuNmWZuXtm1AaQCPj9uw6Guv2Ekoi5P",
metadata: {
name: "numeraire",
version: "0.1.3",
spec: "0.1.0",
description: "Created with Anchor"
},
instructions: [
{
name: "add_liquidity",
docs: ["Pool Owner/Whitelist only functions"],
discriminator: [181, 157, 89, 67, 143, 182, 52, 72],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "payer_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "AddLiquidityData"
}
}
}
],
returns: "u64"
},
{
name: "compound",
discriminator: [165, 208, 251, 78, 242, 160, 141, 47],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "payer_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: []
},
{
name: "create_pool",
discriminator: [233, 146, 209, 142, 207, 104, 64, 188],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "arg",
path: "data.pool_seed"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "creator_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_program_2022",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
},
{
name: "associated_token_program",
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
},
{
name: "system_program",
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "CreateStablePoolData"
}
}
}
]
},
{
name: "init_virtual_stable_pair",
discriminator: [228, 18, 163, 161, 101, 204, 106, 172],
accounts: [
{
name: "x_mint"
},
{
name: "pair",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "x_mint"
},
{
kind: "arg",
path: "data.pair_seed"
}
]
}
},
{
name: "pair_authority",
pda: {
seeds: [
{
kind: "account",
path: "pair"
},
{
kind: "const",
value: [97, 117, 116, 104, 111, 114, 105, 116, 121]
}
]
}
},
{
name: "x_vault",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pair"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "x_adder",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "x_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"]
},
{
name: "associated_token_program",
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
},
{
name: "system_program",
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "InitVirtualStablePairData"
}
}
}
]
},
{
name: "remove_all_liquidity",
discriminator: [10, 51, 61, 35, 112, 105, 24, 85],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "payer_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: []
},
{
name: "remove_liquidity",
discriminator: [80, 85, 209, 72, 24, 206, 177, 108],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "payer_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "RemoveLiquidityData"
}
}
}
],
returns: "u64"
},
{
name: "set_fee",
discriminator: [18, 154, 24, 18, 237, 214, 19, 80],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "payer",
signer: true
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetFeeData"
}
}
}
]
},
{
name: "set_inv_t_max",
discriminator: [218, 209, 244, 237, 211, 236, 98, 58],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "payer",
signer: true
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetInvTMaxData"
}
}
}
]
},
{
name: "set_lp_token_metadata",
discriminator: [71, 73, 56, 155, 202, 142, 100, 150],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "metadata_account",
writable: true,
pda: {
seeds: [
{
kind: "const",
value: [109, 101, 116, 97, 100, 97, 116, 97]
},
{
kind: "account",
path: "token_metadata_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "account",
path: "token_metadata_program"
}
}
},
{
name: "payer",
signer: true
},
{
name: "token_metadata_program",
docs: ["Solana ecosystem accounts"],
address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
},
{
name: "token_program",
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "system_program",
address: "11111111111111111111111111111111"
},
{
name: "instructions",
address: "Sysvar1nstructions1111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetMetadataData"
}
}
}
]
},
{
name: "set_numeraire_owner",
discriminator: [6, 199, 177, 104, 86, 61, 93, 253],
accounts: [
{
name: "numeraire_config",
writable: true,
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "pair_mint",
optional: true
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "system_program",
docs: ["Solana ecosystem accounts"],
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetOwnerData"
}
}
}
]
},
{
name: "set_numeraire_status",
discriminator: [10, 17, 5, 71, 204, 171, 126, 173],
accounts: [
{
name: "numeraire_config",
writable: true,
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "pair_mint",
optional: true
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "system_program",
docs: ["Solana ecosystem accounts"],
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetStatusData"
}
}
}
]
},
{
name: "set_numeraire_whitelisted_pool_creator",
discriminator: [147, 51, 31, 255, 111, 2, 189, 173],
accounts: [
{
name: "numeraire_config",
writable: true,
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "pair_mint",
optional: true
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "system_program",
docs: ["Solana ecosystem accounts"],
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetWhilelistedAddrData"
}
}
}
]
},
{
name: "set_owner",
discriminator: [72, 202, 120, 52, 77, 128, 96, 197],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "payer",
signer: true
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetOwnerData"
}
}
}
]
},
{
name: "set_rate",
discriminator: [99, 58, 170, 238, 160, 120, 74, 11],
accounts: [
{
name: "numeraire_config",
writable: true,
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "pair_mint",
optional: true
},
{
name: "payer",
writable: true,
signer: true
},
{
name: "system_program",
docs: ["Solana ecosystem accounts"],
address: "11111111111111111111111111111111"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetRateData"
}
}
}
]
},
{
name: "set_status",
docs: ["Pool Owner only functions"],
discriminator: [181, 184, 224, 203, 193, 29, 177, 224],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "payer",
signer: true
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetStatusData"
}
}
}
]
},
{
name: "set_whitelisted_adder",
discriminator: [74, 38, 140, 129, 228, 73, 236, 105],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "payer",
signer: true
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SetWhilelistedAddrData"
}
}
}
]
},
{
name: "skim",
discriminator: [238, 120, 221, 138, 82, 60, 100, 218],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "lp_mint",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
},
{
kind: "const",
value: [108, 105, 113, 117, 105, 100, 105, 116, 121]
}
]
}
},
{
name: "payer_lp_account",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "payer"
},
{
kind: "account",
path: "token_program"
},
{
kind: "account",
path: "lp_mint"
}
],
program: {
kind: "const",
value: [
140,
151,
37,
143,
78,
36,
137,
241,
187,
61,
16,
41,
20,
142,
13,
131,
11,
90,
19,
153,
218,
255,
16,
132,
4,
142,
123,
216,
219,
233,
248,
89
]
}
}
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: []
},
{
name: "swap_exact_in",
discriminator: [104, 104, 131, 86, 161, 189, 180, 216],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "in_mint",
writable: true
},
{
name: "out_mint",
writable: true
},
{
name: "in_trader",
writable: true
},
{
name: "out_trader",
writable: true
},
{
name: "in_vault",
writable: true,
optional: true
},
{
name: "out_vault",
writable: true,
optional: true
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
docs: [
"The trader account (executing the swap, paying for all rents)"
],
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SwapExactInHintlessData"
}
}
}
],
returns: "u64"
},
{
name: "swap_exact_in_hinted",
discriminator: [98, 239, 244, 233, 16, 236, 40, 49],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "in_mint",
writable: true
},
{
name: "out_mint",
writable: true
},
{
name: "in_trader",
writable: true
},
{
name: "out_trader",
writable: true
},
{
name: "in_vault",
writable: true,
optional: true
},
{
name: "out_vault",
writable: true,
optional: true
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
docs: [
"The trader account (executing the swap, paying for all rents)"
],
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SwapExactInData"
}
}
}
],
returns: "u64"
},
{
name: "swap_exact_in_quote",
discriminator: [68, 209, 177, 170, 185, 100, 29, 191],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "in_mint",
writable: true
},
{
name: "out_mint",
writable: true
},
{
name: "in_trader",
writable: true
},
{
name: "out_trader",
writable: true
},
{
name: "in_vault",
writable: true,
optional: true
},
{
name: "out_vault",
writable: true,
optional: true
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
docs: [
"The trader account (executing the swap, paying for all rents)"
],
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SwapExactInData"
}
}
}
],
returns: "u64"
},
{
name: "swap_exact_out",
discriminator: [250, 73, 101, 33, 38, 207, 75, 184],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "in_mint",
writable: true
},
{
name: "out_mint",
writable: true
},
{
name: "in_trader",
writable: true
},
{
name: "out_trader",
writable: true
},
{
name: "in_vault",
writable: true,
optional: true
},
{
name: "out_vault",
writable: true,
optional: true
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
docs: [
"The trader account (executing the swap, paying for all rents)"
],
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SwapExactOutHintlessData"
}
}
}
],
returns: "u64"
},
{
name: "swap_exact_out_hinted",
discriminator: [153, 208, 206, 70, 62, 234, 98, 182],
accounts: [
{
name: "pool",
writable: true,
pda: {
seeds: [
{
kind: "account",
path: "pool"
}
]
}
},
{
name: "in_mint",
writable: true
},
{
name: "out_mint",
writable: true
},
{
name: "in_trader",
writable: true
},
{
name: "out_trader",
writable: true
},
{
name: "in_vault",
writable: true,
optional: true
},
{
name: "out_vault",
writable: true,
optional: true
},
{
name: "numeraire_config",
pda: {
seeds: [
{
kind: "const",
value: [99, 111, 110, 102, 105, 103]
}
]
}
},
{
name: "payer",
docs: [
"The trader account (executing the swap, paying for all rents)"
],
signer: true
},
{
name: "token_program",
docs: ["Solana ecosystem accounts"],
address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
name: "token_2022_program",
address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
}
],
args: [
{
name: "data",
type: {
defined: {
name: "SwapExactOutData"
}
}
}
],
returns: "u64"
}
],
accounts: [
{
name: "NumeraireConfig",
discriminator: [230, 62, 124, 43, 102, 101, 88, 63]
},
{
name: "StablePool",
discriminator: [239, 91, 93, 162, 171, 14, 42, 66]
},
{
name: "VirtualStablePair",
discriminator: [112, 153, 135, 223, 53, 247, 129, 101]
}
],
events: [
{
name: "AddLiquidity",
discriminator: [31, 94, 125, 90, 227, 52, 61, 186]
},
{
name: "Quote",
discriminator: [133, 244, 92, 134, 193, 24, 187, 158]
},
{
name: "RemoveLiquidity",
discriminator: [116, 244, 97, 232, 103, 31, 152, 58]
},
{
name: "SwapExactIn",
discriminator: [147, 136, 213, 11, 150, 23, 141, 152]
},
{
name: "SwapExactOut",
discriminator: [71, 66, 127, 123, 231, 29, 227, 92]
}
],
errors: [
{
code: 6e3,
name: "OnlyOwner",
msg: "Attempt to call an owner only function not by the owner"
},
{
code: 6001,
name: "InvalidTokenAccountData",
msg: "Token account data is not as expected"
},
{
code: 6002,
name: "InvalidAccountData",
msg: "Account data is not as expected"
},
{
code: 6003,
name: "DecimalsMismatch",
msg: "Token pair decimals mismatch"
},
{
code: 6004,
name: "InvalidTokenExtension",
msg: "Token should not have this extension"
},
{
code: 6005,
name: "IncorrectAccounts",
msg: "Wrong account(s) passed as input"
},
{
code: 6006,
name: "IncorrectAuthority",
msg: "Wrong authority passed as input"
},
{
code: 6007,
name: "InvalidDelegate",
msg: "Delegate not allowed"
},
{
code: 6008,
name: "UnsupportedFeature",
msg: "This feature is currently unsupported or unenabled"
},
{
code: 6009,
name: "FunctionPaused",
msg: "This function is currently paused"
},
{
code: 6010,
name: "InvalidFee",
msg: "Fee must be less than 100 basis points"
},
{
code: 6011,
name: "InvalidPoolCreate",
msg: "Token mints must be ordered by pubkey"
},
{
code: 6012,
name: "InvalidCurveParams",
msg: "Curve params must be positive"
},
{
code: 6013,
name: "InsufficientLiquidity",
msg: "Pool has too little liquidity for action"
},
{
code: 6014,
name: "LiquidityAddUnbalanced",
msg: "Liquidity add does not make pool balanced (or curve params are asymmetric)"
},
{
code: 6015,
name: "InsufficientBalance",
msg: "Input is more than trader balance"
},
{
code: 6016,
name: "InputTooSmall",
msg: "Input is below the minimum expected"
},
{
code: 6017,
name: "InputTooBig",
msg: "Input is more than available liquidity"
},
{
code: 6018,
name: "OutputTooSmall",
msg: "Output is below the minimum expected"
},
{
code: 6019,
name: "InvariantOverflow",
msg: "Invariant computation overflowed"
},
{
code: 6020,
name: "InvariantViolated",
msg: "Invariant does not hold"
},
{
code: 6021,
name: "LiquidityAddTooSmall",
msg: "Depositing too little liquidity"
},
{
code: 6022,
name: "UnsupportedTokenProgram",
msg: "Only Token Program 2022 and/or Token Program are supported"
},
{
code: 6023,
name: "InvalidPoolWeights",
msg: "Some pool weights are zero or nonzero and shouldn't be"
},
{
code: 6024,
name: "SwapOverflowError",
msg: "A swap math operation overflowed"
},
{
code: 6025,
name: "LiquidityMathOverflow",
msg: "An add/remove liquidity math operation overflowed"
},
{
code: 6026,
name: "InvalidBalanceDeltas",
msg: "Some add/remove balance deltas are nonzero and shouldn't be"
},
{
code: 6027,
name: "InvalidPoolParams",
msg: "The provided pool params were not well formed"
},
{
code: 6028,
name: "InvalidHints",
msg: "The hints provided do not bound the swap amounts"
},
{
code: 6029,
name: "FeeError",
msg: "Unexpected fee result"
},
{
code: 6030,
name: "VaultOverflowError",
msg: "A vault math operation overflowed"
},
{
code: 6031,
name: "OutputTooBig",
msg: "Output is above the maximum expected"
},
{
code: 6032,
name: "Unreachable",
msg: "This cannot happen"
},
{
code: 6033,
name: "InvalidAction",
msg: "This action is not allowed"
}
],
types: [
{
name: "AddLiquidity",
type: {
kind: "struct",
fields: [
{
name: "lp_token_mint_amount",
type: "u64"
},
{
name: "x_reserve_deltas",
type: {
array: ["u64", 10]
}
},
{
name: "y_reserve_deltas",
type: {
array: ["u64", 10]
}
},
{
name: "inv_L_deltas",
type: {
array: ["u64", 10]
}
},
{
name: "min_lp_token_mint_amount",
type: "u64"
},
{
name: "trader",
type: "pubkey"
},
{
name: "pool",
type: "pubkey"
}
]
}
},
{
name: "AddLiquidityData",
repr: {
kind: "c"
},
type: {
kind: "struct",
fields: [
{
name: "max_amounts_in",
type: {
array: ["u64", 10]
}
},
{
name: "min_lp_token_mint_amount",
type: "u64"
},
{
name: "take_swaps",
type: "u8"
},
{
name: "swap_paths",
type: {
array: ["u8", 10]
}
},
{
name: "swap_amounts",
type: {
array: ["u64", 10]
}
}
]
}
},
{
name: "CreateStablePoolData",
repr: {
kind: "c"
},
type: {
kind: "struct",
fields: [
{
name: "decimals",
type: "u8"
},
{
name: "fee_num",
type: "u32"
},
{
name: "fee_denom",
type: "u32"
},
{
name: "pool_seed",
type: "pubkey"
},
{
name: "weights",
type: {
array: ["u32", 10]
}
},
{
name: "inv_T",
type: "u64"
},
{
name: "inv_T_max",
type: "u64"
}
]
}
},
{
name: "InitVirtualStablePairData",
repr: {
kind: "c"
},
type: {
kind: "struct",
fields: [
{
name: "decimals",
type: "u8"
},
{
name: "init_amount",
type: "u64"
},
{
name: "curve_Amp",
type: "u128"
},
{
name: "curve_a",
type: "u128"
},
{
name: "curve_b",
type: "u128"
},
{
name: "curve_alpha",
type: "u64"
},
{
name: "curve_beta",
type: "u64"
},
{
name: "pair_seed",
type: "pubkey"
}
]
}
},
{