UNPKG

@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

3,541 lines (3,539 loc) 172 kB
import * as _coral_xyz_anchor_dist_cjs_program_namespace_types from '@coral-xyz/anchor/dist/cjs/program/namespace/types'; import * as _coral_xyz_anchor_dist_cjs_program_namespace_methods from '@coral-xyz/anchor/dist/cjs/program/namespace/methods'; import { MethodsBuilder } from '@coral-xyz/anchor/dist/cjs/program/namespace/methods'; import { PublicKey, Connection, Keypair, VersionedTransaction, TransactionInstruction, AddressLookupTableAccount } from '@solana/web3.js'; import { BN, Wallet, AnchorProvider, Program } from '@coral-xyz/anchor'; import * as bn_js from 'bn.js'; var address = "NUMERUNsFCP3kuNmWZuXtm1AaQCPj9uw6Guv2Ekoi5P"; var metadata = { name: "numeraire", version: "0.1.3", spec: "0.1.0", description: "Created with Anchor" }; var 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" } ]; var 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 ] } ]; var 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 ] } ]; var errors = [ { code: 6000, 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" } ]; var 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" } ] } }, { name: "NumeraireConfig", serialization: "bytemuck", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "owner", type: "pubkey" }, { name: "status", type: "u32" }, { name: "rate_mints", type: { array: [ "pubkey", 10 ] } }, { name: "rate_nums", type: { array: [ "u32", 10 ] } }, { name: "rate_denoms", type: { array: [ "u32", 10 ] } }, { name: "_padding", type: { array: [ "u8", 12 ] } }, { name: "padding", type: { array: [ "u8", 1024 ] } } ] } }, { name: "Quote", type: { kind: "struct", fields: [ { name: "amount", type: "u64" } ] } }, { name: "RemoveLiquidity", type: { kind: "struct", fields: [ { name: "lp_token_redeem_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_amounts_out", type: { array: [ "u64", 10 ] } }, { name: "trader", type: "pubkey" }, { name: "pool", type: "pubkey" } ] } }, { name: "RemoveLiquidityData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "lp_token_redeem_amount", type: "u64" }, { name: "min_amounts_out", type: { array: [ "u64", 10 ] } }, { name: "out_index", type: "u8" } ] } }, { name: "SetFeeData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "fee_num", type: "u32" }, { name: "fee_denom", type: "u32" } ] } }, { name: "SetInvTMaxData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "inv_T_max", type: "u64" } ] } }, { name: "SetMetadataData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "name", type: "string" }, { name: "symbol", type: "string" }, { name: "uri", type: "string" } ] } }, { name: "SetOwnerData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "owner", type: "pubkey" } ] } }, { name: "SetRateData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "rate_mint", type: "pubkey" }, { name: "rate_num", type: "u32" }, { name: "rate_denom", type: "u32" } ] } }, { name: "SetStatusData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "status", type: "u32" } ] } }, { name: "SetWhilelistedAddrData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "whitelisted_addr", type: "pubkey" } ] } }, { name: "StablePool", serialization: "bytemuck", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "pool_seed", type: "pubkey" }, { name: "lp_mint", type: "pubkey" }, { name: "whitelisted_adder", type: "pubkey" }, { name: "owner", type: "pubkey" }, { name: "inv_T", type: "u64" }, { name: "inv_T_max", type: "u64" }, { name: "pairs", type: { array: [ { defined: { name: "VirtualStablePair" } }, 10 ] } }, { name: "weights", type: { array: [ "u32", 10 ] } }, { name: "total_weight", type: "u64" }, { name: "status", type: "u32" }, { name: "fee_num", type: "u32" }, { name: "fee_denom", type: "u32" }, { name: "decimals", type: "u8" }, { name: "num_stables", type: "u8" }, { name: "_padding", type: { array: [ "u8", 2 ] } }, { name: "padding", type: { array: [ "u8", 128 ] } } ] } }, { name: "SwapExactIn", type: { kind: "struct", fields: [ { name: "amount_in", type: "u64" }, { name: "amount_out", type: "u64" }, { name: "min_amount_out", type: "u64" }, { name: "trader", type: "pubkey" }, { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "pool", type: "pubkey" } ] } }, { name: "SwapExactInData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "exact_amount_in", type: "u64" }, { name: "min_amount_out", type: "u64" }, { name: "hints", type: { array: [ "u64", 10 ] } }, { name: "path_hints", type: { array: [ "u8", 10 ] } } ] } }, { name: "SwapExactInHintlessData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "exact_amount_in", type: "u64" }, { name: "min_amount_out", type: "u64" } ] } }, { name: "SwapExactOut", type: { kind: "struct", fields: [ { name: "amount_in", type: "u64" }, { name: "amount_out", type: "u64" }, { name: "max_amount_in", type: "u64" }, { name: "trader", type: "pubkey" }, { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "pool", type: "pubkey" } ] } }, { name: "SwapExactOutData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "exact_amount_out", type: "u64" }, { name: "max_amount_in", type: "u64" }, { name: "hints", type: { array: [ "u64", 10 ] } }, { name: "path_hints", type: { array: [ "u8", 10 ] } } ] } }, { name: "SwapExactOutHintlessData", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "in_index", type: "u8" }, { name: "out_index", type: "u8" }, { name: "exact_amount_out", type: "u64" }, { name: "max_amount_in", type: "u64" } ] } }, { name: "VirtualStablePair", repr: { kind: "c" }, type: { kind: "struct", fields: [ { name: "pair_authority", type: "pubkey" }, { name: "x_reserve_amount", type: "u64" }, { name: "y_reserve", type: "u64" }, { name: "curve_Amp", docs: [ "Curve params. Define bonding curve shape: x + y + a + b - A / (x + a) - A / (y + b) - D = 0" ], type: "u128" }, { name: "curve_a", type: "u128" }, { name: "curve_b", type: "u128" }, { name: "inv_L", docs: [ "Invariant constant. For invariant: x/L + y/L + a + b - A / (x/L + a) - A / (y/L + b) - D = 0" ], type: "u128" }, { name: "owner", type: "pubkey" }, { name: "x_mint", type: "pubkey" }, { name: "x_vault", type: "pubkey" }, { name: "curve_alpha", type: "u64" }, { name: "curve_beta", type: "u64" }, { name: "newest_rate_num", type: "u32" }, { name: "newest_rate_denom", type: "u32" }, { name: "decimals", type: "u8" }, { name: "pair_index", type: "u8" }, { name: "x_is_2022", type: "u8" }, { name: "_padding", type: { array: [ "u8", 5 ] } }, { name: "padding", type: { array: [ "u8", 128 ] } } ] } } ]; var constants = [ { name: "AUTHORITY_SEED", type: "bytes", value: "[97, 117, 116, 104, 111, 114, 105, 116, 121]" }, { name: "CONFIG_SEED", type: "bytes", value: "[99, 111, 110, 102, 105, 103]" }, { name: "LIQUIDITY_SEED", type: "bytes", value: "[108, 105, 113, 117, 105, 100, 105, 116, 121]" }, { name: "LP_TOKEN_PROGRAM", type: "pubkey", value: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { name: "MAX_STABLES_PER_POOL", type: "u8", value: "10" }, { name: "NORMALIZED_VALUE_DECIMALS", type: "u8", value: "6" } ]; var numeraire = { address: address, metadata: metadata, instructions: instructions, accounts: accounts, events: events, errors: errors, types: types, constants: constants }; type Numeraire = { address: "NUMERUNsFCP3kuNmWZuXtm1AaQCPj9uw6Guv2Ekoi5P"; metadata: { name: "numeraire"; version: "0.1.3"; spec: "0.1.0"; description: "Created with Anchor"; }; instructions: [ { name: "addLiquidity"; 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: "lpMint"; writable: true; pda: { seeds: [ { kind: "account"; path: "pool"; }, { kind: "const"; value: [108, 105, 113, 117, 105, 100, 105, 116, 121]; } ]; }; }, { name: "payerLpAccount"; writable: true; pda: { seeds: [ { kind: "account"; path: "payer"; }, { kind: "account"; path: "tokenProgram"; }, { kind: "account"; path: "lpMint"; } ]; 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: "numeraireConfig"; pda: { seeds: [ { kind: "const"; value: [99, 111, 110, 102, 105, 103]; } ]; }; }, { name: "payer"; signer: true; }, { name: "tokenProgram"; docs: ["Solana ecosystem accounts"]; address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "token2022Program"; 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: