UNPKG

@sol-synth-engine/js-client

Version:

JavaScript client for Sol Synth Engine

1,668 lines (1,667 loc) 58.3 kB
/** * Program IDL in camelCase format in order to be used in JS/TS. * * Note that this is only a type helper and is not the actual IDL. The original * IDL can be found at `target/idl/sol_synth_engine.json`. */ export type SolSynthEngine = { address: "Efn1LMT8eTQb8RGMgeZ13WsWyACvxKZh5cqADGx3hc6u"; metadata: { name: "solSynthEngine"; version: "0.1.0"; spec: "0.1.0"; description: "Created with Anchor"; }; instructions: [ { name: "addTreasury"; discriminator: [36, 23, 46, 82, 89, 92, 62, 145]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "market"; writable: true; }, { name: "treasuryMint"; }, { name: "marketTreasuryAccount"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 109, 97, 114, 107, 101, 116, 95, 116, 114, 101, 97, 115, 117, 114, 121, 95, 97, 99, 99, 111, 117, 110, 116 ]; }, { kind: "account"; path: "market"; }, { kind: "account"; path: "treasuryMint"; } ]; }; }, { name: "treasuryOracle"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "addTreasuryParams"; }; }; } ]; }, { name: "addUnderlyingToken"; discriminator: [20, 96, 206, 205, 249, 191, 184, 111]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "market"; writable: true; }, { name: "underlyingToken"; }, { name: "marketUnderlyingTokenAccount"; writable: true; pda: { seeds: [ { kind: "const"; value: [ 109, 97, 114, 107, 101, 116, 95, 117, 110, 100, 101, 114, 108, 121, 105, 110, 103, 95, 116, 111, 107, 101, 110, 95, 97, 99, 99, 111, 117, 110, 116 ]; }, { kind: "account"; path: "market"; }, { kind: "account"; path: "underlyingToken"; } ]; }; }, { name: "underlyingTokenOracle"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "addUnderlyingTokenParams"; }; }; } ]; }, { name: "createMarket"; discriminator: [103, 226, 97, 235, 200, 188, 251, 254]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; pda: { seeds: [ { kind: "const"; value: [109, 97, 114, 107, 101, 116]; }, { kind: "account"; path: "protocolConfig"; }, { kind: "arg"; path: "params.market_index"; } ]; }; }, { name: "syntheticMint"; writable: true; signer: true; }, { name: "syntheticOracle"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "createMarketParams"; }; }; } ]; }, { name: "flashBorrow"; discriminator: [166, 221, 220, 25, 61, 73, 127, 240]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; }, { name: "loan"; writable: true; signer: true; }, { name: "marketTokenAccountToBorrow"; writable: true; }, { name: "userTokenAccountToBorrow"; writable: true; }, { name: "tokenMintToBorrow"; }, { name: "tokenOracle"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; }, { name: "instructionSysvar"; address: "Sysvar1nstructions1111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "flashLoanParams"; }; }; } ]; }, { name: "flashRepay"; discriminator: [182, 143, 19, 23, 39, 221, 184, 78]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; }, { name: "loan"; writable: true; }, { name: "marketTokenAccountToRepay"; writable: true; }, { name: "userTokenAccountToRepay"; writable: true; }, { name: "tokenMintBorrowed"; }, { name: "tokenMintToRepay"; }, { name: "tokenOracle"; }, { name: "tokenProgram"; }, { name: "instructionSysvar"; address: "Sysvar1nstructions1111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "flashLoanParams"; }; }; } ]; }, { name: "initProtocolConfig"; discriminator: [91, 97, 211, 137, 96, 222, 139, 40]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "config"; writable: true; pda: { seeds: [ { kind: "const"; value: [99, 111, 110, 102, 105, 103]; }, { kind: "arg"; path: "params.config_index"; } ]; }; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "params"; type: { defined: { name: "initProtocolConfigParams"; }; }; } ]; }, { name: "mint"; discriminator: [51, 57, 225, 47, 182, 146, 137, 166]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; }, { name: "marketUnderlyingTokenAccount"; writable: true; }, { name: "userUnderlyingTokenAccount"; writable: true; }, { name: "userSyntheticAccount"; writable: true; }, { name: "syntheticMint"; writable: true; }, { name: "underlyingTokenMint"; }, { name: "syntheticOracle"; }, { name: "underlyingTokenOracle"; }, { name: "tokenProgramUnderlying"; }, { name: "tokenProgramSynthetic"; } ]; args: [ { name: "params"; type: { defined: { name: "mintParams"; }; }; } ]; }, { name: "redeem"; discriminator: [184, 12, 86, 149, 70, 196, 97, 225]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; }, { name: "marketUnderlyingTokenAccount"; writable: true; }, { name: "underlyingTokenMint"; }, { name: "underlyingTokenOracle"; }, { name: "syntheticOracle"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: []; }, { name: "requestRedeem"; discriminator: [105, 49, 44, 38, 207, 241, 33, 173]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "protocolConfig"; }, { name: "market"; writable: true; }, { name: "userSyntheticAccount"; writable: true; }, { name: "receiverUnderlyingTokenAccount"; writable: true; }, { name: "redeemRequest"; writable: true; signer: true; }, { name: "syntheticMint"; writable: true; }, { name: "underlyingTokenMint"; }, { name: "tokenProgram"; }, { name: "systemProgram"; address: "11111111111111111111111111111111"; } ]; args: [ { name: "amount"; type: "u64"; } ]; }, { name: "updateProtocolAuthority"; discriminator: [207, 19, 17, 100, 133, 169, 89, 253]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "config"; writable: true; } ]; args: [ { name: "params"; type: { defined: { name: "updateProtocolAuthorityParams"; }; }; } ]; }, { name: "updateProtocolConfig"; discriminator: [197, 97, 123, 54, 221, 168, 11, 135]; accounts: [ { name: "signer"; writable: true; signer: true; }, { name: "config"; writable: true; } ]; args: [ { name: "params"; type: { defined: { name: "updateProtocolConfigParams"; }; }; } ]; } ]; accounts: [ { name: "loan"; discriminator: [20, 195, 70, 117, 165, 227, 182, 1]; }, { name: "market"; discriminator: [219, 190, 213, 55, 0, 227, 198, 154]; }, { name: "protocolConfig"; discriminator: [207, 91, 250, 28, 152, 179, 215, 209]; }, { name: "redeemRequest"; discriminator: [103, 82, 139, 51, 199, 234, 111, 115]; } ]; events: [ { name: "batchRedeemed"; discriminator: [29, 133, 124, 168, 252, 115, 14, 175]; }, { name: "flashBorrowed"; discriminator: [167, 227, 8, 165, 41, 203, 102, 186]; }, { name: "flashRepaid"; discriminator: [195, 212, 61, 3, 173, 144, 29, 65]; }, { name: "marketCreated"; discriminator: [88, 184, 130, 231, 226, 84, 6, 58]; }, { name: "minted"; discriminator: [174, 131, 21, 57, 88, 117, 114, 121]; }, { name: "protocolAuthorityUpdated"; discriminator: [43, 87, 57, 197, 28, 30, 11, 9]; }, { name: "protocolConfigInitialized"; discriminator: [243, 69, 27, 238, 111, 169, 87, 231]; }, { name: "protocolConfigUpdated"; discriminator: [20, 99, 32, 237, 111, 86, 195, 199]; }, { name: "redeemRequested"; discriminator: [5, 130, 67, 249, 243, 168, 11, 88]; }, { name: "redeemed"; discriminator: [14, 29, 183, 71, 31, 165, 107, 38]; }, { name: "treasuryAdded"; discriminator: [221, 133, 19, 21, 42, 43, 32, 16]; }, { name: "underlyingTokenAdded"; discriminator: [38, 31, 107, 92, 15, 10, 147, 165]; } ]; errors: [ { code: 6000; name: "customError"; msg: "Custom error message"; }, { code: 6001; name: "marketPaused"; msg: "Market is paused"; }, { code: 6002; name: "mathOverflow"; msg: "Math overflow"; }, { code: 6003; name: "invalidMarket"; msg: "Invalid market"; }, { code: 6004; name: "invalidLoanUser"; msg: "Invalid loan user"; }, { code: 6005; name: "invalidMarketUnderlyingToken"; msg: "Invalid market underlying token"; }, { code: 6006; name: "invalidMarketUnderlyingTokenOrTreasuryToken"; msg: "Invalid market underlying token or treasury token"; }, { code: 6007; name: "invalidMarketTreasuryToken"; msg: "Invalid market treasury token"; }, { code: 6008; name: "depositedCollateralLimitReached"; msg: "Deposited collateral limit reached"; }, { code: 6009; name: "requestWithdrawalCollateralLimitReached"; msg: "Request withdrawal collateral limit reached"; }, { code: 6010; name: "syntheticSupplyLimitReached"; msg: "Synthetic supply limit reached"; }, { code: 6011; name: "invalidRemainingAccounts"; msg: "Invalid remaining accounts"; }, { code: 6012; name: "invalidRedeemRequest"; msg: "Invalid redeem request"; }, { code: 6013; name: "insufficientBalance"; msg: "Insufficient balance"; }, { code: 6014; name: "invalidTokenAccount"; msg: "Invalid token account"; }, { code: 6015; name: "collateralValueLessThanSyntheticValue"; msg: "Collateral value is less than synthetic value"; }, { code: 6016; name: "amountGreaterThanMaxBorrowAmount"; msg: "Amount is greater than max borrow amount"; }, { code: 6017; name: "amountNotGreaterThanZero"; msg: "Amount is not greater than 0"; }, { code: 6018; name: "invalidInstructionData"; msg: "Invalid instruction data"; }, { code: 6019; name: "invalidFlashLoanInstructions"; msg: "Invalid flash loan instructions"; }, { code: 6020; name: "invalidMarketAuthority"; msg: "Invalid market authority"; }, { code: 6021; name: "invalidMarketAdminAuthority"; msg: "Invalid market admin authority"; }, { code: 6022; name: "invalidProtocolAuthority"; msg: "Invalid protocol authority"; }, { code: 6023; name: "underlyingTokenLimitReached"; msg: "Underlying token limit reached"; }, { code: 6024; name: "treasuryTokenLimitReached"; msg: "Treasury token limit reached"; }, { code: 6025; name: "underlyingTokenNotFound"; msg: "Underlying token not found"; }, { code: 6026; name: "treasuryTokenNotFound"; msg: "Treasury token not found"; }, { code: 6027; name: "underlyingTokenCapacityReached"; msg: "Underlying token capacity reached"; }, { code: 6028; name: "treasuryTokenCapacityReached"; msg: "Treasury token capacity reached"; }, { code: 6029; name: "tokenOracleMismatch"; msg: "Token oracle mismatch"; }, { code: 6030; name: "invalidMarketProtocolConfig"; msg: "Invalid market protocol config"; }, { code: 6031; name: "invalidSyntheticMint"; msg: "Invalid synthetic mint"; }, { code: 6032; name: "invalidUnderlyingTokenMint"; msg: "Invalid underlying token mint"; }, { code: 6033; name: "invalidUnderlyingTokenAccount"; msg: "Invalid underlying token account"; }, { code: 6034; name: "invalidMarketUnderlyingTokenAccount"; msg: "Invalid market underlying token account"; }, { code: 6035; name: "invalidTreasuryAccount"; msg: "Invalid treasury account"; }, { code: 6036; name: "invalidMarketTreasuryAccount"; msg: "Invalid market treasury account"; }, { code: 6037; name: "invalidSyntheticTokenAccount"; msg: "Invalid synthetic token account"; }, { code: 6038; name: "invalidTokenProgram"; msg: "Invalid token program"; }, { code: 6039; name: "invalidOracleFeed"; msg: "Invalid oracle feed"; }, { code: 6040; name: "syntheticAmountLessThanMinMintAmount"; msg: "Synthetic amount is less than min mint amount"; }, { code: 6041; name: "invalidMarketOperatorAuthority"; msg: "Invalid market operator authority"; }, { code: 6042; name: "invalidFlashLoanAmount"; msg: "Invalid flash loan amount"; }, { code: 6043; name: "invalidMarketTokenMint"; msg: "Invalid market token mint"; }, { code: 6044; name: "underlyingTokenDepositAmountTooLow"; msg: "Underlying token deposit amount too low"; } ]; types: [ { name: "addTreasuryParams"; type: { kind: "struct"; fields: [ { name: "maxTreasuryCapacity"; type: "u64"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; } ]; }; }, { name: "addUnderlyingTokenParams"; type: { kind: "struct"; fields: [ { name: "maxUnderlyingCapacity"; type: "u64"; }, { name: "minDepositAmount"; type: "u64"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; } ]; }; }, { name: "batchRedeemed"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "underlyingTokenMint"; type: "pubkey"; }, { name: "syntheticMint"; type: "pubkey"; }, { name: "totalRedeemedUnderlyingToken"; type: "u64"; }, { name: "totalBurnedSynthetic"; type: "u64"; } ]; }; }, { name: "createMarketParams"; type: { kind: "struct"; fields: [ { name: "adminAuthority"; type: "pubkey"; }, { name: "treasuryAuthority"; type: "pubkey"; }, { name: "operator"; type: "pubkey"; }, { name: "marketIndex"; type: "u16"; }, { name: "marketName"; type: { array: ["u8", 32]; }; }, { name: "syntheticMintDecimals"; type: "u8"; }, { name: "maxSyntheticSupply"; type: "u64"; }, { name: "minRedeemAmount"; type: "u64"; }, { name: "oracleSource"; type: { defined: { name: "oracleSource"; }; }; } ]; }; }, { name: "flashBorrowed"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "loan"; type: "pubkey"; }, { name: "tokenMintBorrowed"; type: "pubkey"; }, { name: "tokenAmountBorrowed"; type: "u64"; }, { name: "tokenValueBorrowedScaled"; type: "u128"; }, { name: "tokenPriceBorrowedScaled"; type: "i64"; } ]; }; }, { name: "flashLoanParams"; type: { kind: "struct"; fields: [ { name: "amount"; type: "u64"; }, { name: "minAmountToRepay"; type: "u64"; }, { name: "tokenToBorrow"; type: { defined: { name: "marketToken"; }; }; }, { name: "tokenToRepay"; type: { defined: { name: "marketToken"; }; }; } ]; }; }, { name: "flashRepaid"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "loan"; type: "pubkey"; }, { name: "tokenMintBorrowed"; type: "pubkey"; }, { name: "tokenMintRepaid"; type: "pubkey"; }, { name: "tokenAmountBorrowed"; type: "u64"; }, { name: "tokenPriceBorrowedScaled"; type: "i64"; }, { name: "tokenValueBorrowedScaled"; type: "u128"; }, { name: "tokenAmountRepaid"; type: "u64"; }, { name: "tokenPriceRepaidScaled"; type: "i64"; }, { name: "tokenValueRepaidScaled"; type: "u128"; } ]; }; }, { name: "initProtocolConfigParams"; type: { kind: "struct"; fields: [ { name: "configIndex"; type: "u16"; }, { name: "protocolFeeBps"; type: "u16"; }, { name: "feeAuthority"; type: "pubkey"; } ]; }; }, { name: "loan"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "tokenMintBorrowed"; type: "pubkey"; }, { name: "tokenAmountBorrowed"; type: "u64"; }, { name: "tokenPriceBorrowedScaled"; type: "i64"; }, { name: "tokenValueBorrowedScaled"; type: "u128"; }, { name: "minAmountToRepay"; type: "u64"; } ]; }; }, { name: "market"; serialization: "bytemuck"; repr: { kind: "c"; }; type: { kind: "struct"; fields: [ { name: "protocolConfig"; type: "pubkey"; }, { name: "adminAuthority"; type: "pubkey"; }, { name: "treasuryAuthority"; type: "pubkey"; }, { name: "operator"; type: "pubkey"; }, { name: "syntheticMint"; type: "pubkey"; }, { name: "marketName"; type: { array: ["u8", 32]; }; }, { name: "maxSyntheticSupply"; type: "u64"; }, { name: "totalSyntheticSupply"; type: "u64"; }, { name: "minRedeemAmount"; type: "u64"; }, { name: "underlyingTokens"; type: { array: [ { defined: { name: "underlyingToken"; }; }, 10 ]; }; }, { name: "treasuryTokens"; type: { array: [ { defined: { name: "treasuryToken"; }; }, 10 ]; }; }, { name: "syntheticOracle"; type: { defined: { name: "oracle"; }; }; }, { name: "paddingOracle"; type: { array: ["u8", 4]; }; }, { name: "marketIndex"; type: "u16"; }, { name: "syntheticDecimals"; type: "u8"; }, { name: "seedBump"; type: "u8"; }, { name: "paused"; type: "u8"; }, { name: "padding0"; type: { array: ["u8", 3]; }; } ]; }; }, { name: "marketCreated"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "protocolConfig"; type: "pubkey"; }, { name: "adminAuthority"; type: "pubkey"; }, { name: "operator"; type: "pubkey"; }, { name: "syntheticMint"; type: "pubkey"; }, { name: "syntheticOracle"; type: "pubkey"; }, { name: "marketName"; type: { array: ["u8", 32]; }; }, { name: "marketIndex"; type: "u16"; }, { name: "maxSyntheticSupply"; type: "u64"; }, { name: "syntheticOracleSource"; type: { defined: { name: "oracleSource"; }; }; } ]; }; }, { name: "marketToken"; type: { kind: "enum"; variants: [ { name: "underlyingToken"; }, { name: "treasuryToken"; } ]; }; }, { name: "mintParams"; type: { kind: "struct"; fields: [ { name: "amount"; type: "u64"; }, { name: "minMintAmount"; type: "u64"; } ]; }; }, { name: "minted"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "receiverTokenAccount"; type: "pubkey"; }, { name: "syntheticMint"; type: "pubkey"; }, { name: "syntheticAmount"; type: "u64"; }, { name: "collateralAmount"; type: "u64"; }, { name: "collateralMint"; type: "pubkey"; }, { name: "minMintAmount"; type: "u64"; } ]; }; }, { name: "oracle"; serialization: "bytemuck"; repr: { kind: "c"; }; type: { kind: "struct"; fields: [ { name: "feed"; type: "pubkey"; }, { name: "source"; type: "u8"; }, { name: "padding"; type: { array: ["u8", 3]; }; } ]; }; }, { name: "oracleSource"; repr: { kind: "c"; }; type: { kind: "enum"; variants: [ { name: "pyth"; }, { name: "pyth1K"; }, { name: "pyth1M"; }, { name: "pythStableCoin"; } ]; }; }, { name: "protocolAuthorityUpdated"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "protocolConfig"; type: "pubkey"; }, { name: "oldAdminAuthority"; type: "pubkey"; }, { name: "newAdminAuthority"; type: "pubkey"; } ]; }; }, { name: "protocolConfig"; type: { kind: "struct"; fields: [ { name: "adminAuthority"; type: "pubkey"; }, { name: "feeAuthority"; type: "pubkey"; }, { name: "configIndex"; type: "u16"; }, { name: "protocolFeeBps"; type: "u16"; }, { name: "seedBump"; type: "u8"; } ]; }; }, { name: "protocolConfigInitialized"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "protocolConfig"; type: "pubkey"; }, { name: "configIndex"; type: "u16"; }, { name: "authority"; type: "pubkey"; }, { name: "protocolFeeBps"; type: "u16"; }, { name: "feeAuthority"; type: "pubkey"; } ]; }; }, { name: "protocolConfigUpdated"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "protocolConfig"; type: "pubkey"; }, { name: "protocolFeeBps"; type: "u16"; }, { name: "feeAuthority"; type: "pubkey"; } ]; }; }, { name: "redeemRequest"; type: { kind: "struct"; fields: [ { name: "user"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "receiverUnderlyingTokenAccount"; type: "pubkey"; }, { name: "createdTs"; type: "i64"; }, { name: "syntheticAmount"; type: "u64"; } ]; }; }, { name: "redeemRequested"; type: { kind: "struct"; fields: [ { name: "signer"; type: "pubkey"; }, { name: "market"; type: "pubkey"; }, { name: "redeemRequest"; type: "pubkey"; }, { name: "underlyingTokenMint"; type: "pubkey"; }, { name: "syntheticMint"; type: "pubkey"; }, { name: "receiverUnderlyingTokenAccount"; type: "pubkey"; }, { name: "syntheticAmount"; type: "u64"; } ]; }; }, { name: "redeemed"; type: { kind: "struct"; fields: [ { name: "signer";