@mysten/deepbook-v3 1.6.7 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/dist/_virtual/rolldown_runtime.mjs +18 -0
- package/dist/client.d.mts +9 -6
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +3 -2
- package/dist/client.mjs.map +1 -1
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/account.d.mts.map +1 -1
- package/dist/contracts/deepbook/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
- package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
- package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
- package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/pyth/PriceServiceConnection.d.mts +18 -3
- package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
- package/dist/pyth/PriceServiceConnection.mjs +35 -4
- package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
- package/dist/queries/priceFeedQueries.mjs +50 -18
- package/dist/queries/priceFeedQueries.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.mjs +2 -2
- package/dist/transactions/marginAdmin.mjs.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.mjs +19 -7
- package/dist/transactions/marginLiquidations.mjs.map +1 -1
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginManager.mjs +43 -34
- package/dist/transactions/marginManager.mjs.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/marginTPSL.mjs +19 -10
- package/dist/transactions/marginTPSL.mjs.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/dist/transactions/poolProxy.mjs +34 -27
- package/dist/transactions/poolProxy.mjs.map +1 -1
- package/dist/types/index.d.mts +16 -1
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/config.d.mts +30 -10
- package/dist/utils/config.d.mts.map +1 -1
- package/dist/utils/config.mjs +33 -4
- package/dist/utils/config.mjs.map +1 -1
- package/dist/utils/constants.d.mts +32 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +55 -24
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +10 -10
- package/src/client.ts +9 -1
- package/src/contracts/deepbook/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +149 -28
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +646 -0
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/oracle.ts +59 -0
- package/src/contracts/deepbook_margin/pool_proxy.ts +597 -584
- package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- package/src/contracts/margin_liquidation/liquidation_vault.ts +144 -4
- package/src/contracts/pyth/pyth.ts +2 -4
- package/src/index.ts +4 -0
- package/src/pyth/PriceServiceConnection.ts +69 -8
- package/src/queries/priceFeedQueries.ts +74 -24
- package/src/transactions/marginAdmin.ts +2 -4
- package/src/transactions/marginLiquidations.ts +20 -6
- package/src/transactions/marginManager.ts +43 -33
- package/src/transactions/marginTPSL.ts +19 -9
- package/src/transactions/poolProxy.ts +34 -30
- package/src/types/index.ts +17 -2
- package/src/utils/config.ts +69 -9
- package/src/utils/constants.ts +83 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liquidation_vault.mjs","names":["bag.Bag"],"sources":["../../../src/contracts/margin_liquidation/liquidation_vault.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction } from '@mysten/sui/transactions';\nimport * as bag from './deps/sui/bag.js';\nconst $moduleName = '@deepbook/margin-liquidation::liquidation_vault';\nexport const LIQUIDATION_VAULT = new MoveStruct({\n\tname: `${$moduleName}::LIQUIDATION_VAULT`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const LiquidationVault = new MoveStruct({\n\tname: `${$moduleName}::LiquidationVault`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tvault: bag.Bag,\n\t},\n});\nexport const BalanceKey = new MoveStruct({\n\tname: `${$moduleName}::BalanceKey<phantom T>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AuthorizedTradersKey = new MoveStruct({\n\tname: `${$moduleName}::AuthorizedTradersKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const LiquidationAdminCap = new MoveStruct({\n\tname: `${$moduleName}::LiquidationAdminCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const LiquidationByVault = new MoveStruct({\n\tname: `${$moduleName}::LiquidationByVault`,\n\tfields: {\n\t\tvault_id: bcs.Address,\n\t\tmargin_manager_id: bcs.Address,\n\t\tmargin_pool_id: bcs.Address,\n\t\tbase_in: bcs.u64(),\n\t\tbase_out: bcs.u64(),\n\t\tquote_in: bcs.u64(),\n\t\tquote_out: bcs.u64(),\n\t\trepay_balance_remaining: bcs.u64(),\n\t\tbase_liquidation: bcs.bool(),\n\t},\n});\nexport interface DepositArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tcoin: RawTransactionArgument<string>;\n}\nexport interface DepositOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DepositArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tcoin: RawTransactionArgument<string>,\n\t\t ];\n\ttypeArguments: [string];\n}\nexport function deposit(options: DepositOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'coin'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'deposit',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface WithdrawArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n}\nexport interface WithdrawOptions {\n\tpackage?: string;\n\targuments:\n\t\t| WithdrawArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tamount: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string];\n}\nexport function withdraw(options: WithdrawOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'amount'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'withdraw',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface CreateLiquidationVaultArguments {\n\tLiquidationCap: RawTransactionArgument<string>;\n}\nexport interface CreateLiquidationVaultOptions {\n\tpackage?: string;\n\targuments: CreateLiquidationVaultArguments | [LiquidationCap: RawTransactionArgument<string>];\n}\nexport function createLiquidationVault(options: CreateLiquidationVaultOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['LiquidationCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'create_liquidation_vault',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AuthorizeTraderArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tauthorizedAddress: RawTransactionArgument<string>;\n}\nexport interface AuthorizeTraderOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AuthorizeTraderArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tauthorizedAddress: RawTransactionArgument<string>,\n\t\t ];\n}\nexport function authorizeTrader(options: AuthorizeTraderOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'authorizedAddress'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'authorize_trader',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DeauthorizeTraderArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tauthorizedAddress: RawTransactionArgument<string>;\n}\nexport interface DeauthorizeTraderOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DeauthorizeTraderArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tauthorizedAddress: RawTransactionArgument<string>,\n\t\t ];\n}\nexport function deauthorizeTrader(options: DeauthorizeTraderOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'authorizedAddress'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'deauthorize_trader',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface SwapBaseToQuoteArguments {\n\tself: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\tbaseIn: RawTransactionArgument<number | bigint>;\n\tdeepIn: RawTransactionArgument<number | bigint>;\n\tminQuoteOut: RawTransactionArgument<number | bigint>;\n}\nexport interface SwapBaseToQuoteOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SwapBaseToQuoteArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\tbaseIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tdeepIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tminQuoteOut: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function swapBaseToQuote(options: SwapBaseToQuoteOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64', 'u64', 'u64', '0x2::clock::Clock'] satisfies (\n\t\t| string\n\t\t| null\n\t)[];\n\tconst parameterNames = ['self', 'pool', 'baseIn', 'deepIn', 'minQuoteOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'swap_base_to_quote',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SwapQuoteToBaseArguments {\n\tself: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\tquoteIn: RawTransactionArgument<number | bigint>;\n\tdeepIn: RawTransactionArgument<number | bigint>;\n\tminBaseOut: RawTransactionArgument<number | bigint>;\n}\nexport interface SwapQuoteToBaseOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SwapQuoteToBaseArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\tquoteIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tdeepIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tminBaseOut: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function swapQuoteToBase(options: SwapQuoteToBaseOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64', 'u64', 'u64', '0x2::clock::Clock'] satisfies (\n\t\t| string\n\t\t| null\n\t)[];\n\tconst parameterNames = ['self', 'pool', 'quoteIn', 'deepIn', 'minBaseOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'swap_quote_to_base',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateBaseArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateBaseOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateBaseArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function liquidateBase(options: LiquidateBaseOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_base',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateQuoteArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateQuoteOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateQuoteArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function liquidateQuote(options: LiquidateQuoteOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_quote',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface BalanceArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface BalanceOptions {\n\tpackage?: string;\n\targuments: BalanceArguments | [self: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\nexport function balance(options: BalanceOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'balance',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"liquidation_vault.mjs","names":["bag.Bag"],"sources":["../../../src/contracts/margin_liquidation/liquidation_vault.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\nimport { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { type Transaction } from '@mysten/sui/transactions';\nimport * as bag from './deps/sui/bag.js';\nconst $moduleName = '@deepbook/margin-liquidation::liquidation_vault';\nexport const LIQUIDATION_VAULT = new MoveStruct({\n\tname: `${$moduleName}::LIQUIDATION_VAULT`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const LiquidationVault = new MoveStruct({\n\tname: `${$moduleName}::LiquidationVault`,\n\tfields: {\n\t\tid: bcs.Address,\n\t\tvault: bag.Bag,\n\t},\n});\nexport const BalanceKey = new MoveStruct({\n\tname: `${$moduleName}::BalanceKey<phantom T>`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const AuthorizedTradersKey = new MoveStruct({\n\tname: `${$moduleName}::AuthorizedTradersKey`,\n\tfields: {\n\t\tdummy_field: bcs.bool(),\n\t},\n});\nexport const LiquidationAdminCap = new MoveStruct({\n\tname: `${$moduleName}::LiquidationAdminCap`,\n\tfields: {\n\t\tid: bcs.Address,\n\t},\n});\nexport const LiquidationByVault = new MoveStruct({\n\tname: `${$moduleName}::LiquidationByVault`,\n\tfields: {\n\t\tvault_id: bcs.Address,\n\t\tmargin_manager_id: bcs.Address,\n\t\tmargin_pool_id: bcs.Address,\n\t\tbase_in: bcs.u64(),\n\t\tbase_out: bcs.u64(),\n\t\tquote_in: bcs.u64(),\n\t\tquote_out: bcs.u64(),\n\t\trepay_balance_remaining: bcs.u64(),\n\t\tbase_liquidation: bcs.bool(),\n\t},\n});\nexport interface DepositArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tcoin: RawTransactionArgument<string>;\n}\nexport interface DepositOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DepositArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tcoin: RawTransactionArgument<string>,\n\t\t ];\n\ttypeArguments: [string];\n}\nexport function deposit(options: DepositOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, null] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'coin'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'deposit',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface WithdrawArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tamount: RawTransactionArgument<number | bigint>;\n}\nexport interface WithdrawOptions {\n\tpackage?: string;\n\targuments:\n\t\t| WithdrawArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tamount: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string];\n}\nexport function withdraw(options: WithdrawOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'amount'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'withdraw',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface CreateLiquidationVaultArguments {\n\tLiquidationCap: RawTransactionArgument<string>;\n}\nexport interface CreateLiquidationVaultOptions {\n\tpackage?: string;\n\targuments: CreateLiquidationVaultArguments | [LiquidationCap: RawTransactionArgument<string>];\n}\nexport function createLiquidationVault(options: CreateLiquidationVaultOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['LiquidationCap'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'create_liquidation_vault',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface AuthorizeTraderArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tauthorizedAddress: RawTransactionArgument<string>;\n}\nexport interface AuthorizeTraderOptions {\n\tpackage?: string;\n\targuments:\n\t\t| AuthorizeTraderArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tauthorizedAddress: RawTransactionArgument<string>,\n\t\t ];\n}\nexport function authorizeTrader(options: AuthorizeTraderOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'authorizedAddress'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'authorize_trader',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface DeauthorizeTraderArguments {\n\tself: RawTransactionArgument<string>;\n\tLiquidationCap: RawTransactionArgument<string>;\n\tauthorizedAddress: RawTransactionArgument<string>;\n}\nexport interface DeauthorizeTraderOptions {\n\tpackage?: string;\n\targuments:\n\t\t| DeauthorizeTraderArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tLiquidationCap: RawTransactionArgument<string>,\n\t\t\t\tauthorizedAddress: RawTransactionArgument<string>,\n\t\t ];\n}\nexport function deauthorizeTrader(options: DeauthorizeTraderOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'address'] satisfies (string | null)[];\n\tconst parameterNames = ['self', 'LiquidationCap', 'authorizedAddress'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'deauthorize_trader',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t});\n}\nexport interface SwapBaseToQuoteArguments {\n\tself: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\tbaseIn: RawTransactionArgument<number | bigint>;\n\tdeepIn: RawTransactionArgument<number | bigint>;\n\tminQuoteOut: RawTransactionArgument<number | bigint>;\n}\nexport interface SwapBaseToQuoteOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SwapBaseToQuoteArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\tbaseIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tdeepIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tminQuoteOut: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function swapBaseToQuote(options: SwapBaseToQuoteOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64', 'u64', 'u64', '0x2::clock::Clock'] satisfies (\n\t\tstring | null\n\t)[];\n\tconst parameterNames = ['self', 'pool', 'baseIn', 'deepIn', 'minQuoteOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'swap_base_to_quote',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface SwapQuoteToBaseArguments {\n\tself: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\tquoteIn: RawTransactionArgument<number | bigint>;\n\tdeepIn: RawTransactionArgument<number | bigint>;\n\tminBaseOut: RawTransactionArgument<number | bigint>;\n}\nexport interface SwapQuoteToBaseOptions {\n\tpackage?: string;\n\targuments:\n\t\t| SwapQuoteToBaseArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\tquoteIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tdeepIn: RawTransactionArgument<number | bigint>,\n\t\t\t\tminBaseOut: RawTransactionArgument<number | bigint>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\nexport function swapQuoteToBase(options: SwapQuoteToBaseOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null, null, 'u64', 'u64', 'u64', '0x2::clock::Clock'] satisfies (\n\t\tstring | null\n\t)[];\n\tconst parameterNames = ['self', 'pool', 'quoteIn', 'deepIn', 'minBaseOut'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'swap_quote_to_base',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateBaseArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateBaseOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateBaseArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\n/** Twin: `liquidate_base_upgraded`. Edit both. */\nexport function liquidateBase(options: LiquidateBaseOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_base',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateQuoteArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateQuoteOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateQuoteArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\n/** Twin: `liquidate_quote_upgraded`. Edit both. */\nexport function liquidateQuote(options: LiquidateQuoteOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_quote',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface BalanceArguments {\n\tself: RawTransactionArgument<string>;\n}\nexport interface BalanceOptions {\n\tpackage?: string;\n\targuments: BalanceArguments | [self: RawTransactionArgument<string>];\n\ttypeArguments: [string];\n}\nexport function balance(options: BalanceOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [null] satisfies (string | null)[];\n\tconst parameterNames = ['self'];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'balance',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateBaseUpgradedArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateBaseUpgradedOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateBaseUpgradedArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\n/**\n * `liquidate_base` against Pyth's upgraded Core.\n *\n * Pyth is replacing Core with a separately published package, so its\n * `PriceInfoObject` is a distinct Move type and `liquidate_base`'s frozen\n * signature can never accept it. Once Pyth stops publishing legacy Core the legacy\n * entry aborts on staleness by itself, and this becomes the only way the vault can\n * liquidate. The gate (`should_liquidate`) and the settlement\n * (`settle_base_liquidation`) are shared with the legacy entry; the body between\n * them is duplicated, because the two `PriceInfoObject` types cannot be unified.\n * Twin: `liquidate_base`. Edit both.\n */\nexport function liquidateBaseUpgraded(options: LiquidateBaseUpgradedOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_base_upgraded',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\nexport interface LiquidateQuoteUpgradedArguments {\n\tself: RawTransactionArgument<string>;\n\tmarginManager: RawTransactionArgument<string>;\n\tregistry: RawTransactionArgument<string>;\n\tbaseOracle: RawTransactionArgument<string>;\n\tquoteOracle: RawTransactionArgument<string>;\n\tbaseMarginPool: RawTransactionArgument<string>;\n\tquoteMarginPool: RawTransactionArgument<string>;\n\tpool: RawTransactionArgument<string>;\n\trepayAmount: RawTransactionArgument<number | bigint | null>;\n}\nexport interface LiquidateQuoteUpgradedOptions {\n\tpackage?: string;\n\targuments:\n\t\t| LiquidateQuoteUpgradedArguments\n\t\t| [\n\t\t\t\tself: RawTransactionArgument<string>,\n\t\t\t\tmarginManager: RawTransactionArgument<string>,\n\t\t\t\tregistry: RawTransactionArgument<string>,\n\t\t\t\tbaseOracle: RawTransactionArgument<string>,\n\t\t\t\tquoteOracle: RawTransactionArgument<string>,\n\t\t\t\tbaseMarginPool: RawTransactionArgument<string>,\n\t\t\t\tquoteMarginPool: RawTransactionArgument<string>,\n\t\t\t\tpool: RawTransactionArgument<string>,\n\t\t\t\trepayAmount: RawTransactionArgument<number | bigint | null>,\n\t\t ];\n\ttypeArguments: [string, string];\n}\n/**\n * `liquidate_quote` against Pyth's upgraded Core. See `liquidate_base_upgraded`.\n * Twin: `liquidate_quote`. Edit both.\n */\nexport function liquidateQuoteUpgraded(options: LiquidateQuoteUpgradedOptions) {\n\tconst packageAddress = options.package ?? '@deepbook/margin-liquidation';\n\tconst argumentsTypes = [\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\tnull,\n\t\t'0x1::option::Option<u64>',\n\t\t'0x2::clock::Clock',\n\t] satisfies (string | null)[];\n\tconst parameterNames = [\n\t\t'self',\n\t\t'marginManager',\n\t\t'registry',\n\t\t'baseOracle',\n\t\t'quoteOracle',\n\t\t'baseMarginPool',\n\t\t'quoteMarginPool',\n\t\t'pool',\n\t\t'repayAmount',\n\t];\n\treturn (tx: Transaction) =>\n\t\ttx.moveCall({\n\t\t\tpackage: packageAddress,\n\t\t\tmodule: 'liquidation_vault',\n\t\t\tfunction: 'liquidate_quote_upgraded',\n\t\t\targuments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),\n\t\t\ttypeArguments: options.typeArguments,\n\t\t});\n}\n"],"mappings":"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"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AccountBalances, AccountInfo, AddConditionalOrderParams, BalanceManager, BaseQuantityIn, BaseQuantityOut, BorrowedShares, Coin, Config, CreatePermissionlessPoolParams, CreatePoolAdminParams, DecodedOrderId, InterestConfigParams, Level2Range, Level2TicksFromMid, LockedBalances, ManagerBalance, MarginManager, MarginManagerAssets, MarginManagerBalancesResult, MarginManagerDebts, MarginManagerState, MarginPool, MarginPoolConfigParams, MarginProposalParams, OrderDeepRequiredResult, OrderType, PendingLimitOrderParams, PendingMarketOrderParams, PlaceLimitOrderParams, PlaceMarginLimitOrderParams, PlaceMarginMarketOrderParams, PlaceMarketOrderParams, Pool, PoolBookParams, PoolConfigParams, PoolDeepPrice, PoolTradeParams, ProposalParams, QuantityOut, QuoteQuantityIn, QuoteQuantityOut, ReferralBalances, SelfMatchingOptions, SetEwmaParams, SwapParams, VaultBalances } from "./types/index.mjs";
|
|
2
|
-
import { CoinMap, DeepbookPackageIds, MarginPoolMap, PoolMap, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs } from "./utils/constants.mjs";
|
|
1
|
+
import { AccountBalances, AccountInfo, AddConditionalOrderParams, BalanceManager, BaseQuantityIn, BaseQuantityOut, BorrowedShares, Coin, Config, CreatePermissionlessPoolParams, CreatePoolAdminParams, DecodedOrderId, InterestConfigParams, Level2Range, Level2TicksFromMid, LockedBalances, ManagerBalance, MarginManager, MarginManagerAssets, MarginManagerBalancesResult, MarginManagerDebts, MarginManagerState, MarginPool, MarginPoolConfigParams, MarginProposalParams, OrderDeepRequiredResult, OrderType, PendingLimitOrderParams, PendingMarketOrderParams, PlaceLimitOrderParams, PlaceMarginLimitOrderParams, PlaceMarginMarketOrderParams, PlaceMarketOrderParams, Pool, PoolBookParams, PoolConfigParams, PoolDeepPrice, PoolTradeParams, ProposalParams, PythConfig, QuantityOut, QuoteQuantityIn, QuoteQuantityOut, ReferralBalances, SelfMatchingOptions, SetEwmaParams, SwapParams, VaultBalances } from "./types/index.mjs";
|
|
2
|
+
import { CoinMap, DEEPBOOK_HERMES_PROXY, DeepbookPackageIds, MarginPoolMap, PYTH_UPGRADED_HERMES, PoolMap, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs } from "./utils/constants.mjs";
|
|
3
3
|
import { DEEP_SCALAR, DeepBookConfig, FLOAT_SCALAR, GAS_BUDGET, MAX_TIMESTAMP, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS } from "./utils/config.mjs";
|
|
4
4
|
import { BalanceManagerContract } from "./transactions/balanceManager.mjs";
|
|
5
5
|
import { DeepBookContract } from "./transactions/deepbook.mjs";
|
|
@@ -13,6 +13,7 @@ import { MarginPoolContract } from "./transactions/marginPool.mjs";
|
|
|
13
13
|
import { MarginTPSLContract } from "./transactions/marginTPSL.mjs";
|
|
14
14
|
import { PoolProxyContract } from "./transactions/poolProxy.mjs";
|
|
15
15
|
import { DeepBookClient, DeepBookClientOptions, DeepBookCompatibleClient, DeepBookOptions, deepbook } from "./client.mjs";
|
|
16
|
+
import { PriceServiceConnectionConfig } from "./pyth/PriceServiceConnection.mjs";
|
|
16
17
|
import { SuiPriceServiceConnection, SuiPythClient } from "./pyth/pyth.mjs";
|
|
17
18
|
import { Account } from "./contracts/deepbook/account.mjs";
|
|
18
19
|
import { Balances } from "./contracts/deepbook/balances.mjs";
|
|
@@ -22,4 +23,4 @@ import { VecSet } from "./contracts/deepbook/deps/sui/vec_set.mjs";
|
|
|
22
23
|
import "./types/bcs.mjs";
|
|
23
24
|
import { ConfigurationError, DeepBookError, ErrorMessages, ResourceNotFoundError, ValidationError } from "./utils/errors.mjs";
|
|
24
25
|
import { validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired } from "./utils/validation.mjs";
|
|
25
|
-
export { Account, type AccountBalances, type AccountInfo, type AddConditionalOrderParams, type BalanceManager, BalanceManagerContract, Balances, type BaseQuantityIn, type BaseQuantityOut, type BorrowedShares, type Coin, type CoinMap, type Config, ConfigurationError, type CreatePermissionlessPoolParams, type CreatePoolAdminParams, DEEP_SCALAR, type DecodedOrderId, DeepBookAdminContract, DeepBookClient, type DeepBookClientOptions, type DeepBookCompatibleClient, DeepBookConfig, DeepBookContract, DeepBookError, type DeepBookOptions, type DeepbookPackageIds, ErrorMessages, FLOAT_SCALAR, FlashLoanContract, GAS_BUDGET, GovernanceContract, type InterestConfigParams, type Level2Range, type Level2TicksFromMid, type LockedBalances, MAX_TIMESTAMP, type ManagerBalance, MarginAdminContract, MarginMaintainerContract, type MarginManager, type MarginManagerAssets, type MarginManagerBalancesResult, MarginManagerContract, type MarginManagerDebts, type MarginManagerState, type MarginPool, type MarginPoolConfigParams, MarginPoolContract, type MarginPoolMap, type MarginProposalParams, MarginTPSLContract, Order, OrderDeepPrice, type OrderDeepRequiredResult, OrderType, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS, type PendingLimitOrderParams, type PendingMarketOrderParams, type PlaceLimitOrderParams, type PlaceMarginLimitOrderParams, type PlaceMarginMarketOrderParams, type PlaceMarketOrderParams, type Pool, type PoolBookParams, type PoolConfigParams, type PoolDeepPrice, type PoolMap, PoolProxyContract, type PoolTradeParams, type ProposalParams, type QuantityOut, type QuoteQuantityIn, type QuoteQuantityOut, type ReferralBalances, ResourceNotFoundError, SelfMatchingOptions, type SetEwmaParams, SuiPriceServiceConnection, SuiPythClient, type SwapParams, ValidationError, type VaultBalances, VecSet, deepbook, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs, validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired };
|
|
26
|
+
export { Account, type AccountBalances, type AccountInfo, type AddConditionalOrderParams, type BalanceManager, BalanceManagerContract, Balances, type BaseQuantityIn, type BaseQuantityOut, type BorrowedShares, type Coin, type CoinMap, type Config, ConfigurationError, type CreatePermissionlessPoolParams, type CreatePoolAdminParams, DEEPBOOK_HERMES_PROXY, DEEP_SCALAR, type DecodedOrderId, DeepBookAdminContract, DeepBookClient, type DeepBookClientOptions, type DeepBookCompatibleClient, DeepBookConfig, DeepBookContract, DeepBookError, type DeepBookOptions, type DeepbookPackageIds, ErrorMessages, FLOAT_SCALAR, FlashLoanContract, GAS_BUDGET, GovernanceContract, type InterestConfigParams, type Level2Range, type Level2TicksFromMid, type LockedBalances, MAX_TIMESTAMP, type ManagerBalance, MarginAdminContract, MarginMaintainerContract, type MarginManager, type MarginManagerAssets, type MarginManagerBalancesResult, MarginManagerContract, type MarginManagerDebts, type MarginManagerState, type MarginPool, type MarginPoolConfigParams, MarginPoolContract, type MarginPoolMap, type MarginProposalParams, MarginTPSLContract, Order, OrderDeepPrice, type OrderDeepRequiredResult, OrderType, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS, PYTH_UPGRADED_HERMES, type PendingLimitOrderParams, type PendingMarketOrderParams, type PlaceLimitOrderParams, type PlaceMarginLimitOrderParams, type PlaceMarginMarketOrderParams, type PlaceMarketOrderParams, type Pool, type PoolBookParams, type PoolConfigParams, type PoolDeepPrice, type PoolMap, PoolProxyContract, type PoolTradeParams, type PriceServiceConnectionConfig, type ProposalParams, type PythConfig, type QuantityOut, type QuoteQuantityIn, type QuoteQuantityOut, type ReferralBalances, ResourceNotFoundError, SelfMatchingOptions, type SetEwmaParams, SuiPriceServiceConnection, SuiPythClient, type SwapParams, ValidationError, type VaultBalances, VecSet, deepbook, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs, validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired };
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { Order } from "./contracts/deepbook/order.mjs";
|
|
|
6
6
|
import "./types/bcs.mjs";
|
|
7
7
|
import { BalanceManagerContract } from "./transactions/balanceManager.mjs";
|
|
8
8
|
import { ConfigurationError, DeepBookError, ErrorMessages, ResourceNotFoundError, ValidationError } from "./utils/errors.mjs";
|
|
9
|
-
import { mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs } from "./utils/constants.mjs";
|
|
9
|
+
import { DEEPBOOK_HERMES_PROXY, PYTH_UPGRADED_HERMES, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs } from "./utils/constants.mjs";
|
|
10
10
|
import { DEEP_SCALAR, DeepBookConfig, FLOAT_SCALAR, GAS_BUDGET, MAX_TIMESTAMP, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS } from "./utils/config.mjs";
|
|
11
11
|
import { SuiPriceServiceConnection, SuiPythClient } from "./pyth/pyth.mjs";
|
|
12
12
|
import { OrderType, SelfMatchingOptions } from "./types/index.mjs";
|
|
@@ -23,4 +23,4 @@ import { PoolProxyContract } from "./transactions/poolProxy.mjs";
|
|
|
23
23
|
import { DeepBookClient, deepbook } from "./client.mjs";
|
|
24
24
|
import { validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired } from "./utils/validation.mjs";
|
|
25
25
|
|
|
26
|
-
export { Account, BalanceManagerContract, Balances, ConfigurationError, DEEP_SCALAR, DeepBookAdminContract, DeepBookClient, DeepBookConfig, DeepBookContract, DeepBookError, ErrorMessages, FLOAT_SCALAR, FlashLoanContract, GAS_BUDGET, GovernanceContract, MAX_TIMESTAMP, MarginAdminContract, MarginMaintainerContract, MarginManagerContract, MarginPoolContract, MarginTPSLContract, Order, OrderDeepPrice, OrderType, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS, PoolProxyContract, ResourceNotFoundError, SelfMatchingOptions, SuiPriceServiceConnection, SuiPythClient, ValidationError, VecSet, deepbook, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs, validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired };
|
|
26
|
+
export { Account, BalanceManagerContract, Balances, ConfigurationError, DEEPBOOK_HERMES_PROXY, DEEP_SCALAR, DeepBookAdminContract, DeepBookClient, DeepBookConfig, DeepBookContract, DeepBookError, ErrorMessages, FLOAT_SCALAR, FlashLoanContract, GAS_BUDGET, GovernanceContract, MAX_TIMESTAMP, MarginAdminContract, MarginMaintainerContract, MarginManagerContract, MarginPoolContract, MarginTPSLContract, Order, OrderDeepPrice, OrderType, POOL_CREATION_FEE_DEEP, PRICE_INFO_OBJECT_MAX_AGE_MS, PYTH_UPGRADED_HERMES, PoolProxyContract, ResourceNotFoundError, SelfMatchingOptions, SuiPriceServiceConnection, SuiPythClient, ValidationError, VecSet, deepbook, mainnetCoins, mainnetMarginPools, mainnetPackageIds, mainnetPools, mainnetPythConfigs, testnetCoins, testnetMarginPools, testnetPackageIds, testnetPools, testnetPythConfigs, validateAddress, validateNonEmptyArray, validateNonNegativeNumber, validatePositiveNumber, validateRange, validateRequired };
|
|
@@ -3,6 +3,15 @@ type HexString = string;
|
|
|
3
3
|
type PriceServiceConnectionConfig = {
|
|
4
4
|
timeout?: number;
|
|
5
5
|
httpRetries?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Bearer token for Hermes deployments that authenticate. The endpoint serving Pyth's
|
|
8
|
+
* upgraded Core answers 401 without one.
|
|
9
|
+
*
|
|
10
|
+
* `accessToken` is chosen to converge with the in-flight `@mysten/suins` Pyth migration
|
|
11
|
+
* (ts-sdks#1158), which takes the same credential under this name. That is not yet
|
|
12
|
+
* published, so this is a convergence target rather than an existing convention.
|
|
13
|
+
*/
|
|
14
|
+
accessToken?: string;
|
|
6
15
|
};
|
|
7
16
|
declare class PriceServiceConnection {
|
|
8
17
|
private httpClient;
|
|
@@ -14,13 +23,19 @@ declare class PriceServiceConnection {
|
|
|
14
23
|
*/
|
|
15
24
|
constructor(endpoint: string, config?: PriceServiceConnectionConfig);
|
|
16
25
|
/**
|
|
17
|
-
* Fetch latest
|
|
26
|
+
* Fetch the latest price update data for the given price IDs.
|
|
27
|
+
*
|
|
28
|
+
* Uses Hermes v2 (`/v2/updates/price/latest`). The v1 endpoint (`/api/latest_vaas`)
|
|
29
|
+
* is deprecated; it returned the same payload this reads out of `binary.data`.
|
|
30
|
+
*
|
|
31
|
+
* Hermes returns one accumulator message covering every requested feed, not one per
|
|
32
|
+
* feed, so the result is normally a single element regardless of `priceIds.length`.
|
|
18
33
|
*
|
|
19
34
|
* @param priceIds Array of hex-encoded price IDs.
|
|
20
|
-
* @returns Array of base64
|
|
35
|
+
* @returns Array of base64-encoded update messages.
|
|
21
36
|
*/
|
|
22
37
|
getLatestVaas(priceIds: HexString[]): Promise<string[]>;
|
|
23
38
|
}
|
|
24
39
|
//#endregion
|
|
25
|
-
export { HexString, PriceServiceConnection };
|
|
40
|
+
export { HexString, PriceServiceConnection, PriceServiceConnectionConfig };
|
|
26
41
|
//# sourceMappingURL=PriceServiceConnection.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceServiceConnection.d.mts","names":[],"sources":["../../src/pyth/PriceServiceConnection.ts"],"mappings":";KAMY,SAAA;AAAA,KAKA,4BAAA;EACX,OAAA;EACA,WAAA;AAAA;AAAA,cAEY,sBAAA;EAAA,QACJ,UAAA;
|
|
1
|
+
{"version":3,"file":"PriceServiceConnection.d.mts","names":[],"sources":["../../src/pyth/PriceServiceConnection.ts"],"mappings":";KAMY,SAAA;AAAA,KAKA,4BAAA;EACX,OAAA;EACA,WAAA;;;;;;;;AAWD;EAFC,WAAA;AAAA;AAAA,cAEY,sBAAA;EAAA,QACJ,UAAA;EA8BoC;;;;;;cAvBhC,QAAA,UAAkB,MAAA,GAAS,4BAAA;EAAT;;;;;;;;;;;;EAuBxB,aAAA,CAAc,QAAA,EAAU,SAAA,KAAc,OAAA;AAAA"}
|
|
@@ -12,7 +12,8 @@ var PriceServiceConnection = class {
|
|
|
12
12
|
constructor(endpoint, config) {
|
|
13
13
|
this.httpClient = axios.create({
|
|
14
14
|
baseURL: endpoint,
|
|
15
|
-
timeout: config?.timeout || 5e3
|
|
15
|
+
timeout: config?.timeout || 5e3,
|
|
16
|
+
headers: config?.accessToken ? { Authorization: `Bearer ${config.accessToken}` } : void 0
|
|
16
17
|
});
|
|
17
18
|
axiosRetry(this.httpClient, {
|
|
18
19
|
retries: config?.httpRetries || 3,
|
|
@@ -20,15 +21,45 @@ var PriceServiceConnection = class {
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
|
-
* Fetch latest
|
|
24
|
+
* Fetch the latest price update data for the given price IDs.
|
|
25
|
+
*
|
|
26
|
+
* Uses Hermes v2 (`/v2/updates/price/latest`). The v1 endpoint (`/api/latest_vaas`)
|
|
27
|
+
* is deprecated; it returned the same payload this reads out of `binary.data`.
|
|
28
|
+
*
|
|
29
|
+
* Hermes returns one accumulator message covering every requested feed, not one per
|
|
30
|
+
* feed, so the result is normally a single element regardless of `priceIds.length`.
|
|
24
31
|
*
|
|
25
32
|
* @param priceIds Array of hex-encoded price IDs.
|
|
26
|
-
* @returns Array of base64
|
|
33
|
+
* @returns Array of base64-encoded update messages.
|
|
27
34
|
*/
|
|
28
35
|
async getLatestVaas(priceIds) {
|
|
29
|
-
|
|
36
|
+
let response;
|
|
37
|
+
try {
|
|
38
|
+
response = await this.httpClient.get("/v2/updates/price/latest", { params: {
|
|
39
|
+
"ids[]": priceIds,
|
|
40
|
+
encoding: "base64",
|
|
41
|
+
parsed: false
|
|
42
|
+
} });
|
|
43
|
+
} catch (error) {
|
|
44
|
+
throw new Error(`Hermes request failed: ${describeRequestError(error)}`, { cause: void 0 });
|
|
45
|
+
}
|
|
46
|
+
const data = response.data?.binary?.data;
|
|
47
|
+
if (!Array.isArray(data)) throw new Error(`Unexpected Hermes response: expected 'binary.data' array from /v2/updates/price/latest, got ${JSON.stringify(response.data)?.slice(0, 200)}`);
|
|
48
|
+
return data;
|
|
30
49
|
}
|
|
31
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* A diagnosable one-line summary of a failed request that cannot contain the access token:
|
|
53
|
+
* status and response body only, never the request config or its headers.
|
|
54
|
+
*/
|
|
55
|
+
function describeRequestError(error) {
|
|
56
|
+
const e = error;
|
|
57
|
+
if (e?.response) {
|
|
58
|
+
const body = typeof e.response.data === "string" ? e.response.data : JSON.stringify(e.response.data);
|
|
59
|
+
return `${e.response.status ?? "?"} ${e.response.statusText ?? ""} ${body?.slice(0, 200) ?? ""}`.trim();
|
|
60
|
+
}
|
|
61
|
+
return e?.code ? `${e.code} ${e.message ?? ""}`.trim() : e?.message ?? "unknown error";
|
|
62
|
+
}
|
|
32
63
|
|
|
33
64
|
//#endregion
|
|
34
65
|
export { PriceServiceConnection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceServiceConnection.mjs","names":[],"sources":["../../src/pyth/PriceServiceConnection.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport axios from 'axios';\nimport type { AxiosInstance } from 'axios';\nimport axiosRetry from 'axios-retry';\n\nexport type HexString = string;\nexport type PriceFeedRequestConfig = {\n\tverbose?: boolean;\n\tbinary?: boolean;\n};\nexport type PriceServiceConnectionConfig = {\n\ttimeout?: number;\n\thttpRetries?: number;\n};\nexport class PriceServiceConnection {\n\tprivate httpClient: AxiosInstance;\n\t/**\n\t * Constructs a new Connection.\n\t *\n\t * @param endpoint endpoint URL to the price service.\n\t * @param config Optional configuration for custom setups.\n\t */\n\tconstructor(endpoint: string, config?: PriceServiceConnectionConfig) {\n\t\tthis.httpClient = axios.create({\n\t\t\tbaseURL: endpoint,\n\t\t\ttimeout: config?.timeout || 5000,\n\t\t});\n\t\taxiosRetry(this.httpClient, {\n\t\t\tretries: config?.httpRetries || 3,\n\t\t\tretryDelay: axiosRetry.exponentialDelay,\n\t\t});\n\t}\n\t/**\n\t * Fetch latest
|
|
1
|
+
{"version":3,"file":"PriceServiceConnection.mjs","names":[],"sources":["../../src/pyth/PriceServiceConnection.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport axios from 'axios';\nimport type { AxiosInstance } from 'axios';\nimport axiosRetry from 'axios-retry';\n\nexport type HexString = string;\nexport type PriceFeedRequestConfig = {\n\tverbose?: boolean;\n\tbinary?: boolean;\n};\nexport type PriceServiceConnectionConfig = {\n\ttimeout?: number;\n\thttpRetries?: number;\n\t/**\n\t * Bearer token for Hermes deployments that authenticate. The endpoint serving Pyth's\n\t * upgraded Core answers 401 without one.\n\t *\n\t * `accessToken` is chosen to converge with the in-flight `@mysten/suins` Pyth migration\n\t * (ts-sdks#1158), which takes the same credential under this name. That is not yet\n\t * published, so this is a convergence target rather than an existing convention.\n\t */\n\taccessToken?: string;\n};\nexport class PriceServiceConnection {\n\tprivate httpClient: AxiosInstance;\n\t/**\n\t * Constructs a new Connection.\n\t *\n\t * @param endpoint endpoint URL to the price service.\n\t * @param config Optional configuration for custom setups.\n\t */\n\tconstructor(endpoint: string, config?: PriceServiceConnectionConfig) {\n\t\tthis.httpClient = axios.create({\n\t\t\tbaseURL: endpoint,\n\t\t\ttimeout: config?.timeout || 5000,\n\t\t\theaders: config?.accessToken ? { Authorization: `Bearer ${config.accessToken}` } : undefined,\n\t\t});\n\t\taxiosRetry(this.httpClient, {\n\t\t\tretries: config?.httpRetries || 3,\n\t\t\tretryDelay: axiosRetry.exponentialDelay,\n\t\t});\n\t}\n\t/**\n\t * Fetch the latest price update data for the given price IDs.\n\t *\n\t * Uses Hermes v2 (`/v2/updates/price/latest`). The v1 endpoint (`/api/latest_vaas`)\n\t * is deprecated; it returned the same payload this reads out of `binary.data`.\n\t *\n\t * Hermes returns one accumulator message covering every requested feed, not one per\n\t * feed, so the result is normally a single element regardless of `priceIds.length`.\n\t *\n\t * @param priceIds Array of hex-encoded price IDs.\n\t * @returns Array of base64-encoded update messages.\n\t */\n\tasync getLatestVaas(priceIds: HexString[]): Promise<string[]> {\n\t\tlet response;\n\t\ttry {\n\t\t\tresponse = await this.httpClient.get('/v2/updates/price/latest', {\n\t\t\t\tparams: {\n\t\t\t\t\t// Serialized explicitly rather than relying on axios's array encoding, which is\n\t\t\t\t\t// what Hermes expects and what a future axios major could change under us.\n\t\t\t\t\t'ids[]': priceIds,\n\t\t\t\t\tencoding: 'base64',\n\t\t\t\t\tparsed: false,\n\t\t\t\t},\n\t\t\t});\n\t\t} catch (error) {\n\t\t\t// An axios error carries `config.headers` — including `Authorization` — and both\n\t\t\t// `JSON.stringify(err)` and `err.toJSON()` serialize it. Callers log failed requests,\n\t\t\t// so letting the raw error escape would put the bearer token in their logs. Re-throw\n\t\t\t// a plain error carrying only what is useful for diagnosis.\n\t\t\tthrow new Error(`Hermes request failed: ${describeRequestError(error)}`, {\n\t\t\t\tcause: undefined,\n\t\t\t});\n\t\t}\n\n\t\tconst data = response.data?.binary?.data;\n\t\tif (!Array.isArray(data)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unexpected Hermes response: expected 'binary.data' array from /v2/updates/price/latest, got ${JSON.stringify(\n\t\t\t\t\tresponse.data,\n\t\t\t\t)?.slice(0, 200)}`,\n\t\t\t);\n\t\t}\n\n\t\treturn data;\n\t}\n}\n\n/**\n * A diagnosable one-line summary of a failed request that cannot contain the access token:\n * status and response body only, never the request config or its headers.\n */\nfunction describeRequestError(error: unknown): string {\n\tconst e = error as {\n\t\tresponse?: { status?: number; statusText?: string; data?: unknown };\n\t\tcode?: string;\n\t\tmessage?: string;\n\t};\n\tif (e?.response) {\n\t\tconst body =\n\t\t\ttypeof e.response.data === 'string' ? e.response.data : JSON.stringify(e.response.data);\n\t\treturn `${e.response.status ?? '?'} ${e.response.statusText ?? ''} ${body?.slice(0, 200) ?? ''}`.trim();\n\t}\n\t// No response: a transport failure. `message` is a fixed axios string (\"timeout of 5000ms\n\t// exceeded\", \"Network Error\") that embeds no header material.\n\treturn e?.code ? `${e.code} ${e.message ?? ''}`.trim() : (e?.message ?? 'unknown error');\n}\n"],"mappings":";;;;AAwBA,IAAa,yBAAb,MAAoC;;;;;;;CAQnC,YAAY,UAAkB,QAAuC;AACpE,OAAK,aAAa,MAAM,OAAO;GAC9B,SAAS;GACT,SAAS,QAAQ,WAAW;GAC5B,SAAS,QAAQ,cAAc,EAAE,eAAe,UAAU,OAAO,eAAe,GAAG;GACnF,CAAC;AACF,aAAW,KAAK,YAAY;GAC3B,SAAS,QAAQ,eAAe;GAChC,YAAY,WAAW;GACvB,CAAC;;;;;;;;;;;;;;CAcH,MAAM,cAAc,UAA0C;EAC7D,IAAI;AACJ,MAAI;AACH,cAAW,MAAM,KAAK,WAAW,IAAI,4BAA4B,EAChE,QAAQ;IAGP,SAAS;IACT,UAAU;IACV,QAAQ;IACR,EACD,CAAC;WACM,OAAO;AAKf,SAAM,IAAI,MAAM,0BAA0B,qBAAqB,MAAM,IAAI,EACxE,OAAO,QACP,CAAC;;EAGH,MAAM,OAAO,SAAS,MAAM,QAAQ;AACpC,MAAI,CAAC,MAAM,QAAQ,KAAK,CACvB,OAAM,IAAI,MACT,+FAA+F,KAAK,UACnG,SAAS,KACT,EAAE,MAAM,GAAG,IAAI,GAChB;AAGF,SAAO;;;;;;;AAQT,SAAS,qBAAqB,OAAwB;CACrD,MAAM,IAAI;AAKV,KAAI,GAAG,UAAU;EAChB,MAAM,OACL,OAAO,EAAE,SAAS,SAAS,WAAW,EAAE,SAAS,OAAO,KAAK,UAAU,EAAE,SAAS,KAAK;AACxF,SAAO,GAAG,EAAE,SAAS,UAAU,IAAI,GAAG,EAAE,SAAS,cAAc,GAAG,GAAG,MAAM,MAAM,GAAG,IAAI,IAAI,KAAK,MAAM;;AAIxG,QAAO,GAAG,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,WAAW,KAAK,MAAM,GAAI,GAAG,WAAW"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ConfigurationError } from "../utils/errors.mjs";
|
|
2
|
+
import { DEEPBOOK_HERMES_PROXY, PYTH_UPGRADED_HERMES } from "../utils/constants.mjs";
|
|
1
3
|
import { PRICE_INFO_OBJECT_MAX_AGE_MS } from "../utils/config.mjs";
|
|
2
4
|
import { PriceInfoObject } from "../contracts/pyth/price_info.mjs";
|
|
3
5
|
import { SuiPriceServiceConnection, SuiPythClient } from "../pyth/pyth.mjs";
|
|
@@ -8,16 +10,47 @@ var PriceFeedQueries = class {
|
|
|
8
10
|
constructor(ctx) {
|
|
9
11
|
this.#ctx = ctx;
|
|
10
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* The Hermes endpoint serving the Pyth deployment margin is configured against.
|
|
15
|
+
*
|
|
16
|
+
* There are two routes, chosen by whether the caller brought
|
|
17
|
+
* credentials. With `accessToken` set, the SDK talks to Pyth directly and no DeepBook
|
|
18
|
+
* infrastructure is in the path — the token is sent to Pyth's own host, so a token
|
|
19
|
+
* minted for some other endpoint must be paired with an explicit `hermesEndpoint`.
|
|
20
|
+
*
|
|
21
|
+
* Note the converse too: an explicit `hermesEndpoint` wins over everything, and the
|
|
22
|
+
* token is sent to whatever host it names. Point it at a mirror or staging proxy while
|
|
23
|
+
* a production token is still configured and the credential goes there.
|
|
24
|
+
*
|
|
25
|
+
* Without a token it falls back to the DeepBook-operated proxy, which supplies
|
|
26
|
+
* credentials server-side; that proxy is not deployed yet, so today this path throws a
|
|
27
|
+
* `ConfigurationError` instead. An explicit `hermesEndpoint` overrides both.
|
|
28
|
+
*/
|
|
29
|
+
#hermesEndpoint() {
|
|
30
|
+
const { hermesEndpoint, accessToken } = this.#ctx.config.pyth;
|
|
31
|
+
if (hermesEndpoint) return hermesEndpoint;
|
|
32
|
+
if (accessToken) return PYTH_UPGRADED_HERMES;
|
|
33
|
+
if (DEEPBOOK_HERMES_PROXY) return DEEPBOOK_HERMES_PROXY;
|
|
34
|
+
throw new ConfigurationError("Pushing price updates against Pyth's upgraded Core needs credentials: its Hermes answers 401 unauthenticated. Set the client's `pythAccessToken` option (or `pyth.accessToken`), or point `pyth.hermesEndpoint` at an endpoint that supplies credentials itself.");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A Hermes connection for the active Pyth deployment, carrying any configured auth
|
|
38
|
+
* headers. The endpoint serving the upgraded Core requires an `Authorization` header
|
|
39
|
+
* and answers 401 without one.
|
|
40
|
+
*/
|
|
41
|
+
#connection() {
|
|
42
|
+
const { accessToken } = this.#ctx.config.pyth;
|
|
43
|
+
return new SuiPriceServiceConnection(this.#hermesEndpoint(), accessToken ? { accessToken } : void 0);
|
|
44
|
+
}
|
|
11
45
|
async getPriceInfoObject(tx, coinKey) {
|
|
12
46
|
this.#ctx.config.requirePyth();
|
|
13
47
|
const currentTime = Date.now();
|
|
14
48
|
const priceInfoObjectAge = await this.getPriceInfoObjectAge(coinKey);
|
|
15
|
-
if (priceInfoObjectAge && currentTime - priceInfoObjectAge * 1e3 < PRICE_INFO_OBJECT_MAX_AGE_MS) return
|
|
16
|
-
const connection =
|
|
17
|
-
const priceIDs = [this.#ctx.config.
|
|
49
|
+
if (priceInfoObjectAge && currentTime - priceInfoObjectAge * 1e3 < PRICE_INFO_OBJECT_MAX_AGE_MS) return this.#ctx.config.getPriceInfoObjectId(coinKey);
|
|
50
|
+
const connection = this.#connection();
|
|
51
|
+
const priceIDs = [this.#ctx.config.getFeedId(coinKey)];
|
|
18
52
|
const priceUpdateData = await connection.getPriceFeedsUpdateData(priceIDs);
|
|
19
|
-
const wormholeStateId = this.#ctx.config.pyth
|
|
20
|
-
const pythStateId = this.#ctx.config.pyth.pythStateId;
|
|
53
|
+
const { pythStateId, wormholeStateId } = this.#ctx.config.pyth;
|
|
21
54
|
return (await new SuiPythClient(this.#ctx.client, pythStateId, wormholeStateId).updatePriceFeeds(tx, priceUpdateData, priceIDs))[0];
|
|
22
55
|
}
|
|
23
56
|
async getPriceInfoObjects(tx, coinKeys) {
|
|
@@ -27,7 +60,7 @@ var PriceFeedQueries = class {
|
|
|
27
60
|
const coinToObjectId = {};
|
|
28
61
|
const objectIds = [];
|
|
29
62
|
for (const coinKey of coinKeys) {
|
|
30
|
-
const priceInfoObjectId = this.#ctx.config.
|
|
63
|
+
const priceInfoObjectId = this.#ctx.config.getPriceInfoObjectId(coinKey);
|
|
31
64
|
coinToObjectId[coinKey] = priceInfoObjectId;
|
|
32
65
|
objectIds.push(priceInfoObjectId);
|
|
33
66
|
}
|
|
@@ -50,24 +83,23 @@ var PriceFeedQueries = class {
|
|
|
50
83
|
}
|
|
51
84
|
if (staleCoinKeys.length === 0) return result;
|
|
52
85
|
const staleFeedIds = [];
|
|
53
|
-
const
|
|
86
|
+
const feedIdToCoinKeys = {};
|
|
54
87
|
for (const coinKey of staleCoinKeys) {
|
|
55
|
-
const feedId = this.#ctx.config.
|
|
56
|
-
|
|
57
|
-
|
|
88
|
+
const feedId = this.#ctx.config.getFeedId(coinKey);
|
|
89
|
+
if (!feedIdToCoinKeys[feedId]) {
|
|
90
|
+
feedIdToCoinKeys[feedId] = [];
|
|
91
|
+
staleFeedIds.push(feedId);
|
|
92
|
+
}
|
|
93
|
+
feedIdToCoinKeys[feedId].push(coinKey);
|
|
58
94
|
}
|
|
59
|
-
const priceUpdateData = await
|
|
60
|
-
const wormholeStateId = this.#ctx.config.pyth
|
|
61
|
-
const pythStateId = this.#ctx.config.pyth.pythStateId;
|
|
95
|
+
const priceUpdateData = await this.#connection().getPriceFeedsUpdateData(staleFeedIds);
|
|
96
|
+
const { pythStateId, wormholeStateId } = this.#ctx.config.pyth;
|
|
62
97
|
const updatedObjectIds = await new SuiPythClient(this.#ctx.client, pythStateId, wormholeStateId).updatePriceFeeds(tx, priceUpdateData, staleFeedIds);
|
|
63
|
-
for (let i = 0; i < staleFeedIds.length; i++)
|
|
64
|
-
const coinKey = feedIdToCoinKey[staleFeedIds[i]];
|
|
65
|
-
result[coinKey] = updatedObjectIds[i];
|
|
66
|
-
}
|
|
98
|
+
for (let i = 0; i < staleFeedIds.length; i++) for (const coinKey of feedIdToCoinKeys[staleFeedIds[i]]) result[coinKey] = updatedObjectIds[i];
|
|
67
99
|
return result;
|
|
68
100
|
}
|
|
69
101
|
async getPriceInfoObjectAge(coinKey) {
|
|
70
|
-
const priceInfoObjectId = this.#ctx.config.
|
|
102
|
+
const priceInfoObjectId = this.#ctx.config.getPriceInfoObjectId(coinKey);
|
|
71
103
|
const res = await this.#ctx.client.core.getObject({
|
|
72
104
|
objectId: priceInfoObjectId,
|
|
73
105
|
include: { content: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceFeedQueries.mjs","names":["#ctx"],"sources":["../../src/queries/priceFeedQueries.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { PriceInfoObject } from '../contracts/pyth/price_info.js';\nimport { SuiPriceServiceConnection, SuiPythClient } from '../pyth/pyth.js';\nimport { PRICE_INFO_OBJECT_MAX_AGE_MS } from '../utils/config.js';\nimport type { QueryContext } from './context.js';\n\nexport class PriceFeedQueries {\n\t#ctx: QueryContext;\n\n\tconstructor(ctx: QueryContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\tasync getPriceInfoObject(tx: Transaction, coinKey: string): Promise<string> {\n\t\tthis.#ctx.config.requirePyth();\n\t\tconst currentTime = Date.now();\n\t\tconst priceInfoObjectAge = await this.getPriceInfoObjectAge(coinKey);\n\t\tif (\n\t\t\tpriceInfoObjectAge &&\n\t\t\tcurrentTime - priceInfoObjectAge * 1000 < PRICE_INFO_OBJECT_MAX_AGE_MS\n\t\t) {\n\t\t\treturn
|
|
1
|
+
{"version":3,"file":"priceFeedQueries.mjs","names":["#ctx","#hermesEndpoint","#connection"],"sources":["../../src/queries/priceFeedQueries.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { PriceInfoObject } from '../contracts/pyth/price_info.js';\nimport { SuiPriceServiceConnection, SuiPythClient } from '../pyth/pyth.js';\nimport { PRICE_INFO_OBJECT_MAX_AGE_MS } from '../utils/config.js';\nimport { DEEPBOOK_HERMES_PROXY, PYTH_UPGRADED_HERMES } from '../utils/constants.js';\nimport { ConfigurationError } from '../utils/errors.js';\nimport type { QueryContext } from './context.js';\n\nexport class PriceFeedQueries {\n\t#ctx: QueryContext;\n\n\tconstructor(ctx: QueryContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/**\n\t * The Hermes endpoint serving the Pyth deployment margin is configured against.\n\t *\n\t * There are two routes, chosen by whether the caller brought\n\t * credentials. With `accessToken` set, the SDK talks to Pyth directly and no DeepBook\n\t * infrastructure is in the path — the token is sent to Pyth's own host, so a token\n\t * minted for some other endpoint must be paired with an explicit `hermesEndpoint`.\n\t *\n\t * Note the converse too: an explicit `hermesEndpoint` wins over everything, and the\n\t * token is sent to whatever host it names. Point it at a mirror or staging proxy while\n\t * a production token is still configured and the credential goes there.\n\t *\n\t * Without a token it falls back to the DeepBook-operated proxy, which supplies\n\t * credentials server-side; that proxy is not deployed yet, so today this path throws a\n\t * `ConfigurationError` instead. An explicit `hermesEndpoint` overrides both.\n\t */\n\t#hermesEndpoint(): string {\n\t\tconst { hermesEndpoint, accessToken } = this.#ctx.config.pyth;\n\t\tif (hermesEndpoint) {\n\t\t\treturn hermesEndpoint;\n\t\t}\n\n\t\tif (accessToken) {\n\t\t\treturn PYTH_UPGRADED_HERMES;\n\t\t}\n\t\tif (DEEPBOOK_HERMES_PROXY) {\n\t\t\treturn DEEPBOOK_HERMES_PROXY;\n\t\t}\n\n\t\tthrow new ConfigurationError(\n\t\t\t\"Pushing price updates against Pyth's upgraded Core needs credentials: its Hermes answers 401 unauthenticated. Set the client's `pythAccessToken` option (or `pyth.accessToken`), or point `pyth.hermesEndpoint` at an endpoint that supplies credentials itself.\",\n\t\t);\n\t}\n\n\t/**\n\t * A Hermes connection for the active Pyth deployment, carrying any configured auth\n\t * headers. The endpoint serving the upgraded Core requires an `Authorization` header\n\t * and answers 401 without one.\n\t */\n\t#connection(): SuiPriceServiceConnection {\n\t\tconst { accessToken } = this.#ctx.config.pyth;\n\t\treturn new SuiPriceServiceConnection(\n\t\t\tthis.#hermesEndpoint(),\n\t\t\taccessToken ? { accessToken } : undefined,\n\t\t);\n\t}\n\n\tasync getPriceInfoObject(tx: Transaction, coinKey: string): Promise<string> {\n\t\tthis.#ctx.config.requirePyth();\n\t\tconst currentTime = Date.now();\n\t\tconst priceInfoObjectAge = await this.getPriceInfoObjectAge(coinKey);\n\t\tif (\n\t\t\tpriceInfoObjectAge &&\n\t\t\tcurrentTime - priceInfoObjectAge * 1000 < PRICE_INFO_OBJECT_MAX_AGE_MS\n\t\t) {\n\t\t\treturn this.#ctx.config.getPriceInfoObjectId(coinKey);\n\t\t}\n\n\t\tconst connection = this.#connection();\n\n\t\tconst priceIDs = [this.#ctx.config.getFeedId(coinKey)];\n\n\t\tconst priceUpdateData = await connection.getPriceFeedsUpdateData(priceIDs);\n\n\t\tconst { pythStateId, wormholeStateId } = this.#ctx.config.pyth;\n\n\t\tconst client = new SuiPythClient(this.#ctx.client, pythStateId, wormholeStateId);\n\n\t\treturn (await client.updatePriceFeeds(tx, priceUpdateData, priceIDs))[0];\n\t}\n\n\tasync getPriceInfoObjects(tx: Transaction, coinKeys: string[]): Promise<Record<string, string>> {\n\t\tthis.#ctx.config.requirePyth();\n\t\tif (coinKeys.length === 0) {\n\t\t\treturn {};\n\t\t}\n\n\t\tconst currentTime = Date.now();\n\n\t\tconst coinToObjectId: Record<string, string> = {};\n\t\tconst objectIds: string[] = [];\n\t\tfor (const coinKey of coinKeys) {\n\t\t\tconst priceInfoObjectId = this.#ctx.config.getPriceInfoObjectId(coinKey);\n\t\t\tcoinToObjectId[coinKey] = priceInfoObjectId;\n\t\t\tobjectIds.push(priceInfoObjectId);\n\t\t}\n\n\t\tconst res = await this.#ctx.client.core.getObjects({\n\t\t\tobjectIds,\n\t\t\tinclude: { content: true },\n\t\t});\n\n\t\tconst staleCoinKeys: string[] = [];\n\t\tconst result: Record<string, string> = {};\n\n\t\tfor (let i = 0; i < coinKeys.length; i++) {\n\t\t\tconst coinKey = coinKeys[i];\n\t\t\tconst obj = res.objects[i];\n\n\t\t\tif (obj instanceof Error || !obj?.content) {\n\t\t\t\tstaleCoinKeys.push(coinKey);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst priceInfoObject = PriceInfoObject.parse(obj.content);\n\t\t\tconst arrivalTime = Number(priceInfoObject.price_info.arrival_time);\n\t\t\tconst age = currentTime - arrivalTime * 1000;\n\n\t\t\tif (age >= PRICE_INFO_OBJECT_MAX_AGE_MS) {\n\t\t\t\tstaleCoinKeys.push(coinKey);\n\t\t\t} else {\n\t\t\t\tresult[coinKey] = coinToObjectId[coinKey];\n\t\t\t}\n\t\t}\n\n\t\tif (staleCoinKeys.length === 0) {\n\t\t\treturn result;\n\t\t}\n\n\t\t// Distinct coins can share a feed. No shipped map has a collision — every configured\n\t\t// coin is on its own feed — but `coins` is a public constructor option, and coins\n\t\t// tracking the same underlying (a wrapped asset priced off its reference, say) are\n\t\t// the normal reason to supply one. Deduplicate before building the update:\n\t\t// a feed listed twice would emit two `update_single_price_feed` calls against the same\n\t\t// object off one hot-potato vector, and pay two update fees for it. One feed can also\n\t\t// map to several coins, so the reverse index holds a list, not a single key.\n\t\tconst staleFeedIds: string[] = [];\n\t\tconst feedIdToCoinKeys: Record<string, string[]> = {};\n\t\tfor (const coinKey of staleCoinKeys) {\n\t\t\tconst feedId = this.#ctx.config.getFeedId(coinKey);\n\t\t\tif (!feedIdToCoinKeys[feedId]) {\n\t\t\t\tfeedIdToCoinKeys[feedId] = [];\n\t\t\t\tstaleFeedIds.push(feedId);\n\t\t\t}\n\t\t\tfeedIdToCoinKeys[feedId].push(coinKey);\n\t\t}\n\n\t\tconst connection = this.#connection();\n\n\t\tconst priceUpdateData = await connection.getPriceFeedsUpdateData(staleFeedIds);\n\n\t\tconst { pythStateId, wormholeStateId } = this.#ctx.config.pyth;\n\t\tconst pythClient = new SuiPythClient(this.#ctx.client, pythStateId, wormholeStateId);\n\n\t\tconst updatedObjectIds = await pythClient.updatePriceFeeds(tx, priceUpdateData, staleFeedIds);\n\n\t\tfor (let i = 0; i < staleFeedIds.length; i++) {\n\t\t\tfor (const coinKey of feedIdToCoinKeys[staleFeedIds[i]]) {\n\t\t\t\tresult[coinKey] = updatedObjectIds[i];\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync getPriceInfoObjectAge(coinKey: string): Promise<number> {\n\t\tconst priceInfoObjectId = this.#ctx.config.getPriceInfoObjectId(coinKey);\n\t\tconst res = await this.#ctx.client.core.getObject({\n\t\t\tobjectId: priceInfoObjectId,\n\t\t\tinclude: {\n\t\t\t\tcontent: true,\n\t\t\t},\n\t\t});\n\n\t\tif (!res.object?.content) {\n\t\t\tthrow new Error(`Price info object not found for ${coinKey}`);\n\t\t}\n\n\t\tconst priceInfoObject = PriceInfoObject.parse(res.object.content);\n\t\treturn Number(priceInfoObject.price_info.arrival_time);\n\t}\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeepBookConfig } from "../utils/config.mjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_transactions18 from "@mysten/sui/transactions";
|
|
3
3
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
4
4
|
|
|
5
5
|
//#region src/transactions/balanceManager.d.ts
|
|
@@ -21,7 +21,7 @@ declare class BalanceManagerContract {
|
|
|
21
21
|
* @description Create a new BalanceManager, manually set the owner. Returns the manager.
|
|
22
22
|
* @returns A function that takes a Transaction object
|
|
23
23
|
*/
|
|
24
|
-
createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) =>
|
|
24
|
+
createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
25
25
|
/**
|
|
26
26
|
* @description Share the BalanceManager
|
|
27
27
|
* @param {TransactionArgument} manager The BalanceManager to share
|
|
@@ -65,38 +65,38 @@ declare class BalanceManagerContract {
|
|
|
65
65
|
* @param {string} managerKey The key of the BalanceManager
|
|
66
66
|
* @returns A function that takes a Transaction object
|
|
67
67
|
*/
|
|
68
|
-
generateProof: (managerKey: string) => (tx: Transaction) =>
|
|
68
|
+
generateProof: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
69
69
|
/**
|
|
70
70
|
* @description Generate a trade proof as the owner
|
|
71
71
|
* @param {string} managerId The ID of the BalanceManager
|
|
72
72
|
* @returns A function that takes a Transaction object
|
|
73
73
|
*/
|
|
74
|
-
generateProofAsOwner: (managerId: string) => (tx: Transaction) =>
|
|
74
|
+
generateProofAsOwner: (managerId: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
75
75
|
/**
|
|
76
76
|
* @description Generate a trade proof as a trader
|
|
77
77
|
* @param {string} managerId The ID of the BalanceManager
|
|
78
78
|
* @param {string} tradeCapId The ID of the tradeCap
|
|
79
79
|
* @returns A function that takes a Transaction object
|
|
80
80
|
*/
|
|
81
|
-
generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) =>
|
|
81
|
+
generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
82
82
|
/**
|
|
83
83
|
* @description Mint a TradeCap
|
|
84
84
|
* @param {string} managerKey The name of the BalanceManager
|
|
85
85
|
* @returns A function that takes a Transaction object
|
|
86
86
|
*/
|
|
87
|
-
mintTradeCap: (managerKey: string) => (tx: Transaction) =>
|
|
87
|
+
mintTradeCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
88
88
|
/**
|
|
89
89
|
* @description Mint a DepositCap
|
|
90
90
|
* @param {string} managerKey The name of the BalanceManager
|
|
91
91
|
* @returns A function that takes a Transaction object
|
|
92
92
|
*/
|
|
93
|
-
mintDepositCap: (managerKey: string) => (tx: Transaction) =>
|
|
93
|
+
mintDepositCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
94
94
|
/**
|
|
95
95
|
* @description Mint a WithdrawalCap
|
|
96
96
|
* @param {string} managerKey The name of the BalanceManager
|
|
97
97
|
* @returns A function that takes a Transaction object
|
|
98
98
|
*/
|
|
99
|
-
mintWithdrawalCap: (managerKey: string) => (tx: Transaction) =>
|
|
99
|
+
mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
100
100
|
/**
|
|
101
101
|
* @description Deposit using the DepositCap
|
|
102
102
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -112,7 +112,7 @@ declare class BalanceManagerContract {
|
|
|
112
112
|
* @param {number} amountToWithdraw The amount to withdraw
|
|
113
113
|
* @returns A function that takes a Transaction object
|
|
114
114
|
*/
|
|
115
|
-
withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) =>
|
|
115
|
+
withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
116
116
|
/**
|
|
117
117
|
* @description Set the referral for the BalanceManager for a specific pool
|
|
118
118
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -147,20 +147,20 @@ declare class BalanceManagerContract {
|
|
|
147
147
|
* @param {string} referralId The ID of the referral to get the owner of
|
|
148
148
|
* @returns A function that takes a Transaction object
|
|
149
149
|
*/
|
|
150
|
-
balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) =>
|
|
150
|
+
balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
151
151
|
/**
|
|
152
152
|
* @description Get the pool ID associated with a referral (DeepBookPoolReferral)
|
|
153
153
|
* @param {string} referralId The ID of the referral to get the pool ID of
|
|
154
154
|
* @returns A function that takes a Transaction object
|
|
155
155
|
*/
|
|
156
|
-
balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) =>
|
|
156
|
+
balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
157
157
|
/**
|
|
158
158
|
* @description Get the referral ID from the balance manager for a specific pool
|
|
159
159
|
* @param {string} managerKey The name of the BalanceManager
|
|
160
160
|
* @param {string} poolKey Key of the pool to get the referral for
|
|
161
161
|
* @returns A function that takes a Transaction object
|
|
162
162
|
*/
|
|
163
|
-
getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) =>
|
|
163
|
+
getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => _mysten_sui_transactions18.TransactionResult;
|
|
164
164
|
/**
|
|
165
165
|
* @description Revoke a TradeCap. This also revokes the associated DepositCap and WithdrawCap.
|
|
166
166
|
* @param {string} managerKey The name of the BalanceManager
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balanceManager.d.mts","names":[],"sources":["../../src/transactions/balanceManager.ts"],"mappings":";;;;;;;;cAYa,sBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EA6BsD;;;;EArB1E,4BAAA,SAAsC,EAAA,EAAI,WAAA;EAyGwB;;;;EApFlE,6BAAA,GAAiC,YAAA,cAA0B,EAAA,EAAI,WAAA,KAAW,
|
|
1
|
+
{"version":3,"file":"balanceManager.d.mts","names":[],"sources":["../../src/transactions/balanceManager.ts"],"mappings":";;;;;;;;cAYa,sBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EA6BsD;;;;EArB1E,4BAAA,SAAsC,EAAA,EAAI,WAAA;EAyGwB;;;;EApFlE,6BAAA,GAAiC,YAAA,cAA0B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAuIZ;;;;;EAzH9D,mBAAA,GAAuB,OAAA,EAAS,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAsKJ;;;;;;;EArJzD,kBAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAmQvB;;;;;;;;EAxOjD,mBAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,gBAAA,UAA0B,SAAA,cAC/D,EAAA,EAAI,WAAA;EA2TsE;;;;;;;EArS5E,sBAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,SAAA,cAAuB,EAAA,EAAI,WAAA;EAjHtD;;;;;;EAqIZ,mBAAA,GAAuB,UAAA,UAAoB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAxGT;;;;;EAyH3D,aAAA,GAAiB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA3GC;;;;;EAyHzD,oBAAA,GAAwB,SAAA,cAAuB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAvGM;;;;;;EAsHpE,qBAAA,GAAyB,SAAA,UAAmB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAzFjF;;;;;EAuGF,YAAA,GAAgB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAhFO;;;;;EAgG9D,cAAA,GAAkB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA3DzD;;;;;EA2EA,iBAAA,GAAqB,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA7DpC;;;;;;;EA+ExB,cAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAjEJ;;;;;;;EA+FpE,eAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,gBAAA,cAA8B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAlElE;;;;;;;EA4FlB,yBAAA,GACE,UAAA,UAAoB,QAAA,UAAkB,QAAA,EAAU,mBAAA,MAAyB,EAAA,EAAI,WAAA;EA7EnB;;;;;;;EA8F5D,2BAAA,GACE,UAAA,UAAoB,OAAA,UAAiB,QAAA,EAAU,mBAAA,MAAyB,EAAA,EAAI,WAAA;EAW9E,sBAAA,GAA0B,UAAA,cAAwB,EAAA,EAAI,WAAA;EAxDhC;;;;;EAuEtB,KAAA,GAAS,UAAA,cAAwB,EAAA,EAAI,WAAA;EA5CnC;;;;;EA2DF,EAAA,GAAM,UAAA,cAAwB,EAAA,EAAI,WAAA;EA1ClC;;;;;EAyDA,2BAAA,GAA+B,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAxDI;;;;;EAsE1E,4BAAA,GAAgC,UAAA,cAAwB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA5C9D;;;;;;EA2DT,2BAAA,GAA+B,UAAA,UAAoB,OAAA,cAAqB,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA7BvF;;;;;;EA8CA,cAAA,GAAkB,UAAA,UAAoB,UAAA,cAAwB,EAAA,EAAI,WAAA;AAAA"}
|