@mysten/deepbook-v3 1.3.5 → 1.4.0

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/contracts/deepbook/account.d.mts +18 -18
  3. package/dist/contracts/deepbook/balances.d.mts +4 -4
  4. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  5. package/dist/transactions/balanceManager.d.mts +12 -12
  6. package/dist/transactions/deepbook.d.mts +20 -20
  7. package/dist/transactions/deepbookAdmin.d.mts +31 -2
  8. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  9. package/dist/transactions/deepbookAdmin.mjs +34 -2
  10. package/dist/transactions/deepbookAdmin.mjs.map +1 -1
  11. package/dist/transactions/marginAdmin.d.mts +38 -7
  12. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  13. package/dist/transactions/marginAdmin.mjs +48 -0
  14. package/dist/transactions/marginAdmin.mjs.map +1 -1
  15. package/dist/transactions/marginLiquidations.d.mts +3 -3
  16. package/dist/transactions/marginMaintainer.d.mts +5 -5
  17. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  18. package/dist/transactions/marginMaintainer.mjs +4 -4
  19. package/dist/transactions/marginMaintainer.mjs.map +1 -1
  20. package/dist/transactions/marginManager.d.mts +116 -23
  21. package/dist/transactions/marginManager.d.mts.map +1 -1
  22. package/dist/transactions/marginManager.mjs +133 -1
  23. package/dist/transactions/marginManager.mjs.map +1 -1
  24. package/dist/transactions/marginPool.d.mts +18 -18
  25. package/dist/transactions/marginRegistry.d.mts +15 -15
  26. package/dist/transactions/marginRegistry.d.mts.map +1 -1
  27. package/dist/transactions/marginTPSL.d.mts +14 -11
  28. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  29. package/dist/transactions/marginTPSL.mjs +5 -1
  30. package/dist/transactions/marginTPSL.mjs.map +1 -1
  31. package/dist/transactions/poolProxy.d.mts +19 -9
  32. package/dist/transactions/poolProxy.d.mts.map +1 -1
  33. package/dist/transactions/poolProxy.mjs +31 -21
  34. package/dist/transactions/poolProxy.mjs.map +1 -1
  35. package/dist/types/index.d.mts +1 -1
  36. package/dist/types/index.mjs.map +1 -1
  37. package/dist/utils/config.d.mts +1 -0
  38. package/dist/utils/config.d.mts.map +1 -1
  39. package/dist/utils/config.mjs +3 -0
  40. package/dist/utils/config.mjs.map +1 -1
  41. package/dist/utils/constants.d.mts +3 -0
  42. package/dist/utils/constants.d.mts.map +1 -1
  43. package/dist/utils/constants.mjs +4 -2
  44. package/dist/utils/constants.mjs.map +1 -1
  45. package/package.json +3 -3
  46. package/src/transactions/deepbookAdmin.ts +64 -2
  47. package/src/transactions/marginAdmin.ts +79 -0
  48. package/src/transactions/marginMaintainer.ts +4 -4
  49. package/src/transactions/marginManager.ts +244 -1
  50. package/src/transactions/marginTPSL.ts +10 -3
  51. package/src/transactions/poolProxy.ts +45 -21
  52. package/src/types/index.ts +1 -1
  53. package/src/utils/config.ts +4 -0
  54. package/src/utils/constants.ts +5 -2
@@ -4,14 +4,16 @@ const testnetPackageIds = {
4
4
  REGISTRY_ID: "0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1",
5
5
  DEEP_TREASURY_ID: "0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb",
6
6
  MARGIN_PACKAGE_ID: "0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6",
7
+ MARGIN_V1: "0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6",
7
8
  MARGIN_REGISTRY_ID: "0x48d7640dfae2c6e9ceeada197a7a1643984b5a24c55a0c6c023dac77e0339f75",
8
9
  LIQUIDATION_PACKAGE_ID: "0x8d69c3ef3ef580e5bf87b933ce28de19a5d0323588d1a44b9c60b4001741aa24"
9
10
  };
10
11
  const mainnetPackageIds = {
11
- DEEPBOOK_PACKAGE_ID: "0xf48222c4e057fa468baf136bff8e12504209d43850c5778f76159292a96f621e",
12
+ DEEPBOOK_PACKAGE_ID: "0x0e735f8c93a95722efd73521aca7a7652c0bb71ed1daf41b26dfd7d1ff71f748",
12
13
  REGISTRY_ID: "0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d",
13
14
  DEEP_TREASURY_ID: "0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe",
14
- MARGIN_PACKAGE_ID: "0xfbd322126f1452fd4c89aedbaeb9fd0c44df9b5cedbe70d76bf80dc086031377",
15
+ MARGIN_PACKAGE_ID: "0x124bb3d8105d6d301c0d40feaa54d65df6b301e4d8ddd5eb8475b0f8a18cff2e",
16
+ MARGIN_V1: "0x97d9473771b01f77b0940c589484184b49f6444627ec121314fae6a6d36fb86b",
15
17
  MARGIN_REGISTRY_ID: "0x0e40998b359a9ccbab22a98ed21bd4346abf19158bc7980c8291908086b3a742",
16
18
  LIQUIDATION_PACKAGE_ID: "0x55718c06706bee34c9f3c39f662f10be354a4dcc719699ad72091dc343b641b8"
17
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/utils/constants.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Coin, Pool, MarginPool } from '../types/index.js';\n\nexport type CoinMap = Record<string, Coin>;\nexport type PoolMap = Record<string, Pool>;\nexport type MarginPoolMap = Record<string, MarginPool>;\nexport interface DeepbookPackageIds {\n\tDEEPBOOK_PACKAGE_ID?: string;\n\tREGISTRY_ID?: string;\n\tDEEP_TREASURY_ID?: string;\n\tMARGIN_PACKAGE_ID?: string;\n\tMARGIN_REGISTRY_ID?: string;\n\tLIQUIDATION_PACKAGE_ID?: string;\n}\n\nexport const testnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x22be4cade64bf2d02412c7e8d0e8beea2f78828b948118d46735315409371a3c',\n\tREGISTRY_ID: '0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1',\n\tDEEP_TREASURY_ID: '0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb',\n\tMARGIN_PACKAGE_ID: '0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6',\n\tMARGIN_REGISTRY_ID: '0x48d7640dfae2c6e9ceeada197a7a1643984b5a24c55a0c6c023dac77e0339f75',\n\tLIQUIDATION_PACKAGE_ID: '0x8d69c3ef3ef580e5bf87b933ce28de19a5d0323588d1a44b9c60b4001741aa24',\n} satisfies DeepbookPackageIds;\n\nexport const mainnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0xf48222c4e057fa468baf136bff8e12504209d43850c5778f76159292a96f621e',\n\tREGISTRY_ID: '0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d',\n\tDEEP_TREASURY_ID: '0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe',\n\tMARGIN_PACKAGE_ID: '0xfbd322126f1452fd4c89aedbaeb9fd0c44df9b5cedbe70d76bf80dc086031377',\n\tMARGIN_REGISTRY_ID: '0x0e40998b359a9ccbab22a98ed21bd4346abf19158bc7980c8291908086b3a742',\n\tLIQUIDATION_PACKAGE_ID: '0x55718c06706bee34c9f3c39f662f10be354a4dcc719699ad72091dc343b641b8',\n} satisfies DeepbookPackageIds;\n\nexport const testnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8`,\n\t\ttype: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x99137a18354efa7fb6840889d059fdb04c46a6ce21be97ab60d9ad93e91ac758', // DEEP uses HFT feed on testnet\n\t\tcurrencyId: '0xbf1b77e244f649c736a44898585cc8ac939fbb0bbdf1d8d2a183978cc312e613',\n\t\tpriceInfoObjectId: '0x3d52fffa2cd9e54b39bb36d282bdda560b15b8b4fdf4766a3c58499ef172bafc',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x50c67b3fd225db8912a424dd4baed60ffdde625ed2feaaf283724f9608fea266',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x1ebb295c789cc42b3b2a1606482cd1c7124076a0f5676718501fda8c7fd075a0',\n\t},\n\tDBUSDC: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722',\n\t\tcurrencyId: '0x509db0f9283c9ee4fdc5b99028a439d3639f49e9709e3d7a6de14b3bfdb0c784',\n\t\tpriceInfoObjectId: '0x9c4dd4008297ffa5e480684b8100ec21cc934405ed9a25d4e4d7b6259aad9c81',\n\t},\n\tDBTC: {\n\t\taddress: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86`,\n\t\ttype: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b',\n\t\tcurrencyId: '0x3ef2afa2126704bf721b9c8495d94288f6bd090fc454fe3e1613eb765a8a348f',\n\t\tpriceInfoObjectId: '0x72431a238277695d3f31e4425225a4462674ee6cceeea9d66447b210755fffba',\n\t},\n\tDBUSDT: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT`,\n\t\tscalar: 1000000,\n\t},\n\tWAL: {\n\t\taddress: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76`,\n\t\ttype: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76::wal::WAL`,\n\t\tscalar: 1000000000,\n\t},\n};\n\nexport const mainnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270`,\n\t\ttype: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',\n\t\tcurrencyId: '0x3f2afb7c5f245870a8b8a3808e6dd7042446a0e7504e9d2795372da053858cd9',\n\t\tpriceInfoObjectId: '0x8c7f3a322b94cc69db2a2ac575cbd94bf5766113324c3a3eceac91e3e88a51ed',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',\n\t},\n\tUSDC: {\n\t\taddress: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7`,\n\t\ttype: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',\n\t\tcurrencyId: '0x75cfbbf8c962d542e99a1d15731e6069f60a00db895407785b15d14f606f2b4a',\n\t\tpriceInfoObjectId: '0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',\n\t},\n\tWAL: {\n\t\taddress: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59`,\n\t\ttype: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0xeba0732395fae9dec4bae12e52760b35fc1c5671e2da8b449c9af4efe5d54341',\n\t\tcurrencyId: '0xb6a0c0bacb1c87c3be4dff20c22ef1012125b5724b5b0ff424f852a2651b23fa',\n\t\tpriceInfoObjectId: '0xeb7e669f74d976c0b99b6ef9801e3a77716a95f1a15754e0f1399ce3fb60973d',\n\t},\n\tSUIUSDE: {\n\t\taddress: `0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402`,\n\t\ttype: `0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x8cead549d0e770dea8fdf5e018a85d59585265cf8bff16ba83962fc7996dbb7f',\n\t\tcurrencyId: '0x44f0959110bd9e5e91af0483364c42075ac19f173b28f708989f419ef3560576',\n\t\tpriceInfoObjectId: '0x9b2028bfc829127d2e5ead1691dc3002de9e9b8d8076b4915e5ecc7d9b99d63f',\n\t},\n\tXBTC: {\n\t\taddress: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50`,\n\t\ttype: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xae8f269ed9c4bed616c99a98cf6dfe562bd3202e7f91821a471ff854713851b4',\n\t\tcurrencyId: '0x907bb173bffab7c57bbd3350a633aa32c8770937b496d7d88874087b59200bcc',\n\t\tpriceInfoObjectId: '0xa4b9db1866ee6e2a156e8c36fc66be0f68f232388ebb578c949c2c6beb50128b',\n\t},\n\tUSDSUI: {\n\t\taddress: `0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1`,\n\t\ttype: `0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xd510fcdb3a63f35d3bb118d5db3afc5815a3f13bc55d48abb893b63f0315902a',\n\t\tcurrencyId: '0x535e826a2acddab687c81cb6c6166553b479f61a9023800ec0020baba8d94731',\n\t\tpriceInfoObjectId: '0x68644a3ab7a1aab113a4a68b6115a5b51eba4cb6aaac2d99b734be2e5e748425',\n\t},\n\tWUSDC: {\n\t\taddress: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf`,\n\t\ttype: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tWETH: {\n\t\taddress: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5`,\n\t\ttype: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tBETH: {\n\t\taddress: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29`,\n\t\ttype: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH`,\n\t\tscalar: 100000000,\n\t},\n\tWBTC: {\n\t\taddress: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881`,\n\t\ttype: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tWUSDT: {\n\t\taddress: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c`,\n\t\ttype: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tNS: {\n\t\taddress: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178`,\n\t\ttype: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS`,\n\t\tscalar: 1000000,\n\t},\n\tTYPUS: {\n\t\taddress: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385`,\n\t\ttype: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS`,\n\t\tscalar: 1000000000,\n\t},\n\tAUSD: {\n\t\taddress: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2`,\n\t\ttype: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD`,\n\t\tscalar: 1000000,\n\t},\n\tDRF: {\n\t\taddress: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e`,\n\t\ttype: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF`,\n\t\tscalar: 1000000,\n\t},\n\tSEND: {\n\t\taddress: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7`,\n\t\ttype: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7::send::SEND`,\n\t\tscalar: 1000000,\n\t},\n\tIKA: {\n\t\taddress: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa`,\n\t\ttype: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA`,\n\t\tscalar: 1000000000,\n\t},\n\tALKIMI: {\n\t\taddress: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489`,\n\t\ttype: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489::alkimi::ALKIMI`,\n\t\tscalar: 1000000000,\n\t},\n\tLZWBTC: {\n\t\taddress: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942`,\n\t\ttype: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC`,\n\t\tscalar: 100000000,\n\t},\n\tUSDT: {\n\t\taddress: `0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068`,\n\t\ttype: `0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT`,\n\t\tscalar: 1000000,\n\t},\n};\n\nexport const testnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0x48c95963e9eac37a316b7ae04a0deb761bcdcc2b67912374d6036e7f0e9bae9f`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_DBUSDC: {\n\t\taddress: `0x1c19362ca52b8ffd7a33cee805a67d40f31e6ba303753fd3a4cfdfacea7163a5`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDEEP_DBUSDC: {\n\t\taddress: `0xe86b991f8632217505fd859445f9803967ac84a9d4a1219065bf191fcb74b622`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDBUSDT_DBUSDC: {\n\t\taddress: `0x83970bb02e3636efdff8c141ab06af5e3c9a22e2f74d7f02a9c3430d0d10c1ca`,\n\t\tbaseCoin: 'DBUSDT',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_DBUSDC: {\n\t\taddress: `0xeb524b6aea0ec4b494878582e0b78924208339d360b62aec4a8ecd4031520dbb`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x8c1c1b186c4fddab1ebd53e0895a36c1d1b3b9a77cd34e607bef49a38af0150a`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tDBTC_DBUSDC: {\n\t\taddress: `0x0dce0aa771074eb83d1f4a29d48be8248d4d2190976a5241f66b43ec18fa34de`,\n\t\tbaseCoin: 'DBTC',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n};\n\nexport const mainnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_USDC: {\n\t\taddress: `0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDEEP_USDC: {\n\t\taddress: `0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDT_USDC: {\n\t\taddress: `0x4e2ca3988246e1d50b9bf209abb9c1cbfec65bd95afdacc620a36c67bdb8452f`,\n\t\tbaseCoin: 'WUSDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDC_USDC: {\n\t\taddress: `0xa0b9ebefb38c963fd115f52d71fa64501b79d1adcb5270563f92ce0442376545`,\n\t\tbaseCoin: 'WUSDC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tBETH_USDC: {\n\t\taddress: `0x1109352b9112717bd2a7c3eb9a416fff1ba6951760f5bdd5424cf5e4e5b3e65c`,\n\t\tbaseCoin: 'BETH',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_USDC: {\n\t\taddress: `0x0c0fdd4008740d81a8a7d4281322aee71a1b62c449eb5b142656753d89ebc060`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_SUI: {\n\t\taddress: `0x27c4fdb3b846aa3ae4a65ef5127a309aa3c1f466671471a806d8912a18b253e8`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tTYPUS_SUI: {\n\t\taddress: `0xe8e56f377ab5a261449b92ac42c8ddaacd5671e9fec2179d7933dd1a91200eec`,\n\t\tbaseCoin: 'TYPUS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_AUSD: {\n\t\taddress: `0x183df694ebc852a5f90a959f0f563b82ac9691e42357e9a9fe961d71a1b809c8`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'AUSD',\n\t},\n\tAUSD_USDC: {\n\t\taddress: `0x5661fc7f88fbeb8cb881150a810758cf13700bb4e1f31274a244581b37c303c3`,\n\t\tbaseCoin: 'AUSD',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDRF_SUI: {\n\t\taddress: `0x126865a0197d6ab44bfd15fd052da6db92fd2eb831ff9663451bbfa1219e2af2`,\n\t\tbaseCoin: 'DRF',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSEND_USDC: {\n\t\taddress: `0x1fe7b99c28ded39774f37327b509d58e2be7fff94899c06d22b407496a6fa990`,\n\t\tbaseCoin: 'SEND',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_USDC: {\n\t\taddress: `0x56a1c985c1f1123181d6b881714793689321ba24301b3585eec427436eb1c76d`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x81f5339934c83ea19dd6bcc75c52e83509629a5f71d3257428c2ce47cc94d08b`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tXBTC_USDC: {\n\t\taddress: `0x20b9a3ec7a02d4f344aa1ebc5774b7b0ccafa9a5d76230662fdc0300bb215307`,\n\t\tbaseCoin: 'XBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tIKA_USDC: {\n\t\taddress: `0xfa732993af2b60d04d7049511f801e79426b2b6a5103e22769c0cead982b0f47`,\n\t\tbaseCoin: 'IKA',\n\t\tquoteCoin: 'USDC',\n\t},\n\tALKIMI_SUI: {\n\t\taddress: `0x84752993c6dc6fce70e25ddeb4daddb6592d6b9b0912a0a91c07cfff5a721d89`,\n\t\tbaseCoin: 'ALKIMI',\n\t\tquoteCoin: 'SUI',\n\t},\n\tLZWBTC_USDC: {\n\t\taddress: `0xf5142aafa24866107df628bf92d0358c7da6acc46c2f10951690fd2b8570f117`,\n\t\tbaseCoin: 'LZWBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tUSDT_USDC: {\n\t\taddress: '0xfc28a2fb22579c16d672a1152039cbf671e5f4b9f103feddff4ea06ef3c2bc25',\n\t\tbaseCoin: 'USDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tSUIUSDE_USDC: {\n\t\taddress: '0x0fac1cebf35bde899cd9ecdd4371e0e33f44ba83b8a2902d69186646afa3a94b',\n\t\tbaseCoin: 'SUIUSDE',\n\t\tquoteCoin: 'USDC',\n\t},\n\tSUI_SUIUSDE: {\n\t\taddress: '0x034f3a42e7348de2084406db7a725f9d9d132a56c68324713e6e623601fb4fd7',\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'SUIUSDE',\n\t},\n\tSUI_USDSUI: {\n\t\taddress: '0x826eeacb2799726334aa580396338891205a41cf9344655e526aae6ddd5dc03f',\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDSUI',\n\t},\n\tUSDSUI_USDC: {\n\t\taddress: '0xa374264d43e6baa5aa8b35ff18ff24fdba7443b4bcb884cb4c2f568d32cdac36',\n\t\tbaseCoin: 'USDSUI',\n\t\tquoteCoin: 'USDC',\n\t},\n};\n\nexport const testnetMarginPools = {\n\tSUI: {\n\t\taddress: '0xcdbbe6a72e639b647296788e2e4b1cac5cea4246028ba388ba1332ff9a382eea',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tDBUSDC: {\n\t\taddress: '0xf08568da93834e1ee04f09902ac7b1e78d3fdf113ab4d2106c7265e95318b14d',\n\t\ttype: '0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x610640613f21d9e688d6f8103d17df22315c32e0c80590ce64951a1991378b55',\n\t\ttype: '0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP',\n\t},\n\tDBTC: {\n\t\taddress: '0xf3440b4aafcc8b12fc4b242e9590c52873b8238a0d0e52fbf9dae61d2970796a',\n\t\ttype: '0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC',\n\t},\n};\n\nexport const mainnetMarginPools = {\n\tSUI: {\n\t\taddress: '0x53041c6f86c4782aabbfc1d4fe234a6d37160310c7ee740c915f0a01b7127344',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tUSDC: {\n\t\taddress: '0xba473d9ae278f10af75c50a8fa341e9c6a1c087dc91a3f23e8048baf67d0754f',\n\t\ttype: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x1d723c5cd113296868b55208f2ab5a905184950dd59c48eb7345607d6b5e6af7',\n\t\ttype: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',\n\t},\n\tWAL: {\n\t\taddress: '0x38decd3dbb62bd4723144349bf57bc403b393aee86a51596846a824a1e0c2c01',\n\t\ttype: '0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL',\n\t},\n\tSUIUSDE: {\n\t\taddress: '0xbb990ca04a7743e6c0a25a7fb16f60fc6f6d8bf213624ff03a63f1bb04c3a12f',\n\t\ttype: '0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE',\n\t},\n\tXBTC: {\n\t\taddress: '0x14dfbf54400e0b97e892349310d392bef6d187c2b6709d9b246b8f41c9a13de4',\n\t\ttype: '0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC',\n\t},\n\tUSDSUI: {\n\t\taddress: '0x78a0ddd02745d9b500fb7e9aae2ff8b665d974f00fd1f6060d59f4a8e891402c',\n\t\ttype: '0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI',\n\t},\n};\n\nexport const testnetPythConfigs = {\n\tpythStateId: '0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c',\n\twormholeStateId: '0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790',\n};\n\nexport const mainnetPythConfigs = {\n\tpythStateId: '0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8',\n\twormholeStateId: '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c',\n};\n"],"mappings":";AAiBA,MAAa,oBAAoB;CAChC,qBAAqB;CACrB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,oBAAoB;CACpB,wBAAwB;CACxB;AAED,MAAa,oBAAoB;CAChC,qBAAqB;CACrB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,oBAAoB;CACpB,wBAAwB;CACxB;AAED,MAAa,eAAwB;CACpC,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD;AAED,MAAa,eAAwB;CACpC,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,SAAS;EACR,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,IAAI;EACH,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD;AAED,MAAa,eAAwB;CACpC,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,eAAe;EACd,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD;AAED,MAAa,eAAwB;CACpC,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,QAAQ;EACP,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,cAAc;EACb,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD;AAED,MAAa,qBAAqB;CACjC,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD;AAED,MAAa,qBAAqB;CACjC,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,SAAS;EACR,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN;CACD;AAED,MAAa,qBAAqB;CACjC,aAAa;CACb,iBAAiB;CACjB;AAED,MAAa,qBAAqB;CACjC,aAAa;CACb,iBAAiB;CACjB"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/utils/constants.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Coin, Pool, MarginPool } from '../types/index.js';\n\nexport type CoinMap = Record<string, Coin>;\nexport type PoolMap = Record<string, Pool>;\nexport type MarginPoolMap = Record<string, MarginPool>;\nexport interface DeepbookPackageIds {\n\tDEEPBOOK_PACKAGE_ID?: string;\n\tREGISTRY_ID?: string;\n\tDEEP_TREASURY_ID?: string;\n\tMARGIN_PACKAGE_ID?: string;\n\tMARGIN_V1?: string;\n\tMARGIN_REGISTRY_ID?: string;\n\tLIQUIDATION_PACKAGE_ID?: string;\n}\n\nexport const testnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x22be4cade64bf2d02412c7e8d0e8beea2f78828b948118d46735315409371a3c',\n\tREGISTRY_ID: '0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1',\n\tDEEP_TREASURY_ID: '0x69fffdae0075f8f71f4fa793549c11079266910e8905169845af1f5d00e09dcb',\n\tMARGIN_PACKAGE_ID: '0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6',\n\tMARGIN_V1: '0xd6a42f4df4db73d68cbeb52be66698d2fe6a9464f45ad113ca52b0c6ebd918b6',\n\tMARGIN_REGISTRY_ID: '0x48d7640dfae2c6e9ceeada197a7a1643984b5a24c55a0c6c023dac77e0339f75',\n\tLIQUIDATION_PACKAGE_ID: '0x8d69c3ef3ef580e5bf87b933ce28de19a5d0323588d1a44b9c60b4001741aa24',\n} satisfies DeepbookPackageIds;\n\nexport const mainnetPackageIds = {\n\tDEEPBOOK_PACKAGE_ID: '0x0e735f8c93a95722efd73521aca7a7652c0bb71ed1daf41b26dfd7d1ff71f748',\n\tREGISTRY_ID: '0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d',\n\tDEEP_TREASURY_ID: '0x032abf8948dda67a271bcc18e776dbbcfb0d58c8d288a700ff0d5521e57a1ffe',\n\tMARGIN_PACKAGE_ID: '0x124bb3d8105d6d301c0d40feaa54d65df6b301e4d8ddd5eb8475b0f8a18cff2e',\n\tMARGIN_V1: '0x97d9473771b01f77b0940c589484184b49f6444627ec121314fae6a6d36fb86b',\n\tMARGIN_REGISTRY_ID: '0x0e40998b359a9ccbab22a98ed21bd4346abf19158bc7980c8291908086b3a742',\n\tLIQUIDATION_PACKAGE_ID: '0x55718c06706bee34c9f3c39f662f10be354a4dcc719699ad72091dc343b641b8',\n} satisfies DeepbookPackageIds;\n\nexport const testnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8`,\n\t\ttype: `0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x99137a18354efa7fb6840889d059fdb04c46a6ce21be97ab60d9ad93e91ac758', // DEEP uses HFT feed on testnet\n\t\tcurrencyId: '0xbf1b77e244f649c736a44898585cc8ac939fbb0bbdf1d8d2a183978cc312e613',\n\t\tpriceInfoObjectId: '0x3d52fffa2cd9e54b39bb36d282bdda560b15b8b4fdf4766a3c58499ef172bafc',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x50c67b3fd225db8912a424dd4baed60ffdde625ed2feaaf283724f9608fea266',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x1ebb295c789cc42b3b2a1606482cd1c7124076a0f5676718501fda8c7fd075a0',\n\t},\n\tDBUSDC: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x41f3625971ca2ed2263e78573fe5ce23e13d2558ed3f2e47ab0f84fb9e7ae722',\n\t\tcurrencyId: '0x509db0f9283c9ee4fdc5b99028a439d3639f49e9709e3d7a6de14b3bfdb0c784',\n\t\tpriceInfoObjectId: '0x9c4dd4008297ffa5e480684b8100ec21cc934405ed9a25d4e4d7b6259aad9c81',\n\t},\n\tDBTC: {\n\t\taddress: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86`,\n\t\ttype: `0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b',\n\t\tcurrencyId: '0x3ef2afa2126704bf721b9c8495d94288f6bd090fc454fe3e1613eb765a8a348f',\n\t\tpriceInfoObjectId: '0x72431a238277695d3f31e4425225a4462674ee6cceeea9d66447b210755fffba',\n\t},\n\tDBUSDT: {\n\t\taddress: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7`,\n\t\ttype: `0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDT::DBUSDT`,\n\t\tscalar: 1000000,\n\t},\n\tWAL: {\n\t\taddress: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76`,\n\t\ttype: `0x9ef7676a9f81937a52ae4b2af8d511a28a0b080477c0c2db40b0ab8882240d76::wal::WAL`,\n\t\tscalar: 1000000000,\n\t},\n};\n\nexport const mainnetCoins: CoinMap = {\n\tDEEP: {\n\t\taddress: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270`,\n\t\ttype: `0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',\n\t\tcurrencyId: '0x3f2afb7c5f245870a8b8a3808e6dd7042446a0e7504e9d2795372da053858cd9',\n\t\tpriceInfoObjectId: '0x8c7f3a322b94cc69db2a2ac575cbd94bf5766113324c3a3eceac91e3e88a51ed',\n\t},\n\tSUI: {\n\t\taddress: `0x0000000000000000000000000000000000000000000000000000000000000002`,\n\t\ttype: `0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',\n\t\tcurrencyId: '0xf256d3fb6a50eaa748d94335b34f2982fbc3b63ceec78cafaa29ebc9ebaf2bbc',\n\t\tpriceInfoObjectId: '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',\n\t},\n\tUSDC: {\n\t\taddress: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7`,\n\t\ttype: `0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',\n\t\tcurrencyId: '0x75cfbbf8c962d542e99a1d15731e6069f60a00db895407785b15d14f606f2b4a',\n\t\tpriceInfoObjectId: '0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',\n\t},\n\tWAL: {\n\t\taddress: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59`,\n\t\ttype: `0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL`,\n\t\tscalar: 1000000000,\n\t\tfeed: '0xeba0732395fae9dec4bae12e52760b35fc1c5671e2da8b449c9af4efe5d54341',\n\t\tcurrencyId: '0xb6a0c0bacb1c87c3be4dff20c22ef1012125b5724b5b0ff424f852a2651b23fa',\n\t\tpriceInfoObjectId: '0xeb7e669f74d976c0b99b6ef9801e3a77716a95f1a15754e0f1399ce3fb60973d',\n\t},\n\tSUIUSDE: {\n\t\taddress: `0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402`,\n\t\ttype: `0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE`,\n\t\tscalar: 1000000,\n\t\tfeed: '0x8cead549d0e770dea8fdf5e018a85d59585265cf8bff16ba83962fc7996dbb7f',\n\t\tcurrencyId: '0x44f0959110bd9e5e91af0483364c42075ac19f173b28f708989f419ef3560576',\n\t\tpriceInfoObjectId: '0x9b2028bfc829127d2e5ead1691dc3002de9e9b8d8076b4915e5ecc7d9b99d63f',\n\t},\n\tXBTC: {\n\t\taddress: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50`,\n\t\ttype: `0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC`,\n\t\tscalar: 100000000,\n\t\tfeed: '0xae8f269ed9c4bed616c99a98cf6dfe562bd3202e7f91821a471ff854713851b4',\n\t\tcurrencyId: '0x907bb173bffab7c57bbd3350a633aa32c8770937b496d7d88874087b59200bcc',\n\t\tpriceInfoObjectId: '0xa4b9db1866ee6e2a156e8c36fc66be0f68f232388ebb578c949c2c6beb50128b',\n\t},\n\tUSDSUI: {\n\t\taddress: `0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1`,\n\t\ttype: `0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI`,\n\t\tscalar: 1000000,\n\t\tfeed: '0xd510fcdb3a63f35d3bb118d5db3afc5815a3f13bc55d48abb893b63f0315902a',\n\t\tcurrencyId: '0x535e826a2acddab687c81cb6c6166553b479f61a9023800ec0020baba8d94731',\n\t\tpriceInfoObjectId: '0x68644a3ab7a1aab113a4a68b6115a5b51eba4cb6aaac2d99b734be2e5e748425',\n\t},\n\tWUSDC: {\n\t\taddress: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf`,\n\t\ttype: `0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tWETH: {\n\t\taddress: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5`,\n\t\ttype: `0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tBETH: {\n\t\taddress: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29`,\n\t\ttype: `0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH`,\n\t\tscalar: 100000000,\n\t},\n\tWBTC: {\n\t\taddress: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881`,\n\t\ttype: `0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN`,\n\t\tscalar: 100000000,\n\t},\n\tWUSDT: {\n\t\taddress: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c`,\n\t\ttype: `0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN`,\n\t\tscalar: 1000000,\n\t},\n\tNS: {\n\t\taddress: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178`,\n\t\ttype: `0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS`,\n\t\tscalar: 1000000,\n\t},\n\tTYPUS: {\n\t\taddress: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385`,\n\t\ttype: `0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS`,\n\t\tscalar: 1000000000,\n\t},\n\tAUSD: {\n\t\taddress: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2`,\n\t\ttype: `0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD`,\n\t\tscalar: 1000000,\n\t},\n\tDRF: {\n\t\taddress: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e`,\n\t\ttype: `0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF`,\n\t\tscalar: 1000000,\n\t},\n\tSEND: {\n\t\taddress: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7`,\n\t\ttype: `0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7::send::SEND`,\n\t\tscalar: 1000000,\n\t},\n\tIKA: {\n\t\taddress: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa`,\n\t\ttype: `0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA`,\n\t\tscalar: 1000000000,\n\t},\n\tALKIMI: {\n\t\taddress: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489`,\n\t\ttype: `0x1a8f4bc33f8ef7fbc851f156857aa65d397a6a6fd27a7ac2ca717b51f2fd9489::alkimi::ALKIMI`,\n\t\tscalar: 1000000000,\n\t},\n\tLZWBTC: {\n\t\taddress: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942`,\n\t\ttype: `0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC`,\n\t\tscalar: 100000000,\n\t},\n\tUSDT: {\n\t\taddress: `0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068`,\n\t\ttype: `0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT`,\n\t\tscalar: 1000000,\n\t},\n};\n\nexport const testnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0x48c95963e9eac37a316b7ae04a0deb761bcdcc2b67912374d6036e7f0e9bae9f`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_DBUSDC: {\n\t\taddress: `0x1c19362ca52b8ffd7a33cee805a67d40f31e6ba303753fd3a4cfdfacea7163a5`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDEEP_DBUSDC: {\n\t\taddress: `0xe86b991f8632217505fd859445f9803967ac84a9d4a1219065bf191fcb74b622`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tDBUSDT_DBUSDC: {\n\t\taddress: `0x83970bb02e3636efdff8c141ab06af5e3c9a22e2f74d7f02a9c3430d0d10c1ca`,\n\t\tbaseCoin: 'DBUSDT',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_DBUSDC: {\n\t\taddress: `0xeb524b6aea0ec4b494878582e0b78924208339d360b62aec4a8ecd4031520dbb`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x8c1c1b186c4fddab1ebd53e0895a36c1d1b3b9a77cd34e607bef49a38af0150a`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tDBTC_DBUSDC: {\n\t\taddress: `0x0dce0aa771074eb83d1f4a29d48be8248d4d2190976a5241f66b43ec18fa34de`,\n\t\tbaseCoin: 'DBTC',\n\t\tquoteCoin: 'DBUSDC',\n\t},\n};\n\nexport const mainnetPools: PoolMap = {\n\tDEEP_SUI: {\n\t\taddress: `0xb663828d6217467c8a1838a03793da896cbe745b150ebd57d82f814ca579fc22`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_USDC: {\n\t\taddress: `0xe05dafb5133bcffb8d59f4e12465dc0e9faeaa05e3e342a08fe135800e3e4407`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDEEP_USDC: {\n\t\taddress: `0xf948981b806057580f91622417534f491da5f61aeaf33d0ed8e69fd5691c95ce`,\n\t\tbaseCoin: 'DEEP',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDT_USDC: {\n\t\taddress: `0x4e2ca3988246e1d50b9bf209abb9c1cbfec65bd95afdacc620a36c67bdb8452f`,\n\t\tbaseCoin: 'WUSDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWUSDC_USDC: {\n\t\taddress: `0xa0b9ebefb38c963fd115f52d71fa64501b79d1adcb5270563f92ce0442376545`,\n\t\tbaseCoin: 'WUSDC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tBETH_USDC: {\n\t\taddress: `0x1109352b9112717bd2a7c3eb9a416fff1ba6951760f5bdd5424cf5e4e5b3e65c`,\n\t\tbaseCoin: 'BETH',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_USDC: {\n\t\taddress: `0x0c0fdd4008740d81a8a7d4281322aee71a1b62c449eb5b142656753d89ebc060`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'USDC',\n\t},\n\tNS_SUI: {\n\t\taddress: `0x27c4fdb3b846aa3ae4a65ef5127a309aa3c1f466671471a806d8912a18b253e8`,\n\t\tbaseCoin: 'NS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tTYPUS_SUI: {\n\t\taddress: `0xe8e56f377ab5a261449b92ac42c8ddaacd5671e9fec2179d7933dd1a91200eec`,\n\t\tbaseCoin: 'TYPUS',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSUI_AUSD: {\n\t\taddress: `0x183df694ebc852a5f90a959f0f563b82ac9691e42357e9a9fe961d71a1b809c8`,\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'AUSD',\n\t},\n\tAUSD_USDC: {\n\t\taddress: `0x5661fc7f88fbeb8cb881150a810758cf13700bb4e1f31274a244581b37c303c3`,\n\t\tbaseCoin: 'AUSD',\n\t\tquoteCoin: 'USDC',\n\t},\n\tDRF_SUI: {\n\t\taddress: `0x126865a0197d6ab44bfd15fd052da6db92fd2eb831ff9663451bbfa1219e2af2`,\n\t\tbaseCoin: 'DRF',\n\t\tquoteCoin: 'SUI',\n\t},\n\tSEND_USDC: {\n\t\taddress: `0x1fe7b99c28ded39774f37327b509d58e2be7fff94899c06d22b407496a6fa990`,\n\t\tbaseCoin: 'SEND',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_USDC: {\n\t\taddress: `0x56a1c985c1f1123181d6b881714793689321ba24301b3585eec427436eb1c76d`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'USDC',\n\t},\n\tWAL_SUI: {\n\t\taddress: `0x81f5339934c83ea19dd6bcc75c52e83509629a5f71d3257428c2ce47cc94d08b`,\n\t\tbaseCoin: 'WAL',\n\t\tquoteCoin: 'SUI',\n\t},\n\tXBTC_USDC: {\n\t\taddress: `0x20b9a3ec7a02d4f344aa1ebc5774b7b0ccafa9a5d76230662fdc0300bb215307`,\n\t\tbaseCoin: 'XBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tIKA_USDC: {\n\t\taddress: `0xfa732993af2b60d04d7049511f801e79426b2b6a5103e22769c0cead982b0f47`,\n\t\tbaseCoin: 'IKA',\n\t\tquoteCoin: 'USDC',\n\t},\n\tALKIMI_SUI: {\n\t\taddress: `0x84752993c6dc6fce70e25ddeb4daddb6592d6b9b0912a0a91c07cfff5a721d89`,\n\t\tbaseCoin: 'ALKIMI',\n\t\tquoteCoin: 'SUI',\n\t},\n\tLZWBTC_USDC: {\n\t\taddress: `0xf5142aafa24866107df628bf92d0358c7da6acc46c2f10951690fd2b8570f117`,\n\t\tbaseCoin: 'LZWBTC',\n\t\tquoteCoin: 'USDC',\n\t},\n\tUSDT_USDC: {\n\t\taddress: '0xfc28a2fb22579c16d672a1152039cbf671e5f4b9f103feddff4ea06ef3c2bc25',\n\t\tbaseCoin: 'USDT',\n\t\tquoteCoin: 'USDC',\n\t},\n\tSUIUSDE_USDC: {\n\t\taddress: '0x0fac1cebf35bde899cd9ecdd4371e0e33f44ba83b8a2902d69186646afa3a94b',\n\t\tbaseCoin: 'SUIUSDE',\n\t\tquoteCoin: 'USDC',\n\t},\n\tSUI_SUIUSDE: {\n\t\taddress: '0x034f3a42e7348de2084406db7a725f9d9d132a56c68324713e6e623601fb4fd7',\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'SUIUSDE',\n\t},\n\tSUI_USDSUI: {\n\t\taddress: '0x826eeacb2799726334aa580396338891205a41cf9344655e526aae6ddd5dc03f',\n\t\tbaseCoin: 'SUI',\n\t\tquoteCoin: 'USDSUI',\n\t},\n\tUSDSUI_USDC: {\n\t\taddress: '0xa374264d43e6baa5aa8b35ff18ff24fdba7443b4bcb884cb4c2f568d32cdac36',\n\t\tbaseCoin: 'USDSUI',\n\t\tquoteCoin: 'USDC',\n\t},\n};\n\nexport const testnetMarginPools = {\n\tSUI: {\n\t\taddress: '0xcdbbe6a72e639b647296788e2e4b1cac5cea4246028ba388ba1332ff9a382eea',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tDBUSDC: {\n\t\taddress: '0xf08568da93834e1ee04f09902ac7b1e78d3fdf113ab4d2106c7265e95318b14d',\n\t\ttype: '0xf7152c05930480cd740d7311b5b8b45c6f488e3a53a11c3f74a6fac36a52e0d7::DBUSDC::DBUSDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x610640613f21d9e688d6f8103d17df22315c32e0c80590ce64951a1991378b55',\n\t\ttype: '0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP',\n\t},\n\tDBTC: {\n\t\taddress: '0xf3440b4aafcc8b12fc4b242e9590c52873b8238a0d0e52fbf9dae61d2970796a',\n\t\ttype: '0x6502dae813dbe5e42643c119a6450a518481f03063febc7e20238e43b6ea9e86::dbtc::DBTC',\n\t},\n};\n\nexport const mainnetMarginPools = {\n\tSUI: {\n\t\taddress: '0x53041c6f86c4782aabbfc1d4fe234a6d37160310c7ee740c915f0a01b7127344',\n\t\ttype: '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',\n\t},\n\tUSDC: {\n\t\taddress: '0xba473d9ae278f10af75c50a8fa341e9c6a1c087dc91a3f23e8048baf67d0754f',\n\t\ttype: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n\t},\n\tDEEP: {\n\t\taddress: '0x1d723c5cd113296868b55208f2ab5a905184950dd59c48eb7345607d6b5e6af7',\n\t\ttype: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',\n\t},\n\tWAL: {\n\t\taddress: '0x38decd3dbb62bd4723144349bf57bc403b393aee86a51596846a824a1e0c2c01',\n\t\ttype: '0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL',\n\t},\n\tSUIUSDE: {\n\t\taddress: '0xbb990ca04a7743e6c0a25a7fb16f60fc6f6d8bf213624ff03a63f1bb04c3a12f',\n\t\ttype: '0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE',\n\t},\n\tXBTC: {\n\t\taddress: '0x14dfbf54400e0b97e892349310d392bef6d187c2b6709d9b246b8f41c9a13de4',\n\t\ttype: '0x876a4b7bce8aeaef60464c11f4026903e9afacab79b9b142686158aa86560b50::xbtc::XBTC',\n\t},\n\tUSDSUI: {\n\t\taddress: '0x78a0ddd02745d9b500fb7e9aae2ff8b665d974f00fd1f6060d59f4a8e891402c',\n\t\ttype: '0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI',\n\t},\n};\n\nexport const testnetPythConfigs = {\n\tpythStateId: '0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c',\n\twormholeStateId: '0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790',\n};\n\nexport const mainnetPythConfigs = {\n\tpythStateId: '0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8',\n\twormholeStateId: '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c',\n};\n"],"mappings":";AAkBA,MAAa,oBAAoB;CAChC,qBAAqB;CACrB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,oBAAoB;CACpB,wBAAwB;CACxB;AAED,MAAa,oBAAoB;CAChC,qBAAqB;CACrB,aAAa;CACb,kBAAkB;CAClB,mBAAmB;CACnB,WAAW;CACX,oBAAoB;CACpB,wBAAwB;CACxB;AAED,MAAa,eAAwB;CACpC,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD;AAED,MAAa,eAAwB;CACpC,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,SAAS;EACR,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR,MAAM;EACN,YAAY;EACZ,mBAAmB;EACnB;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,IAAI;EACH,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,OAAO;EACN,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN,QAAQ;EACR;CACD;AAED,MAAa,eAAwB;CACpC,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,eAAe;EACd,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD;AAED,MAAa,eAAwB;CACpC,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,QAAQ;EACP,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,SAAS;EACR,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,UAAU;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,WAAW;EACV,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,cAAc;EACb,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,YAAY;EACX,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD,aAAa;EACZ,SAAS;EACT,UAAU;EACV,WAAW;EACX;CACD;AAED,MAAa,qBAAqB;CACjC,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD;AAED,MAAa,qBAAqB;CACjC,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,KAAK;EACJ,SAAS;EACT,MAAM;EACN;CACD,SAAS;EACR,SAAS;EACT,MAAM;EACN;CACD,MAAM;EACL,SAAS;EACT,MAAM;EACN;CACD,QAAQ;EACP,SAAS;EACT,MAAM;EACN;CACD;AAED,MAAa,qBAAqB;CACjC,aAAa;CACb,iBAAiB;CACjB;AAED,MAAa,qBAAqB;CACjC,aAAa;CACb,iBAAiB;CACjB"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@mysten/deepbook-v3",
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui Deepbook SDK",
5
- "version": "1.3.5",
5
+ "version": "1.4.0",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
8
8
  "main": "./dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "@noble/hashes": "^2.0.1",
34
34
  "axios": "^1.16.0",
35
35
  "axios-retry": "^4.5.0",
36
- "@mysten/bcs": "^2.0.4"
36
+ "@mysten/bcs": "^2.0.5"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@iarna/toml": "^2.2.5",
@@ -48,7 +48,7 @@
48
48
  "wait-on": "^9.0.3"
49
49
  },
50
50
  "peerDependencies": {
51
- "@mysten/sui": "^2.16.1"
51
+ "@mysten/sui": "^2.17.0"
52
52
  },
53
53
  "scripts": {
54
54
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
@@ -315,7 +315,7 @@ export class DeepBookAdminContract {
315
315
  tx.moveCall({
316
316
  target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,
317
317
  arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
318
- typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`],
318
+ typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],
319
319
  });
320
320
  };
321
321
 
@@ -327,7 +327,69 @@ export class DeepBookAdminContract {
327
327
  return tx.moveCall({
328
328
  target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,
329
329
  arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
330
- typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`],
330
+ typeArguments: [`${this.#config.MARGIN_V1}::margin_manager::MarginApp`],
331
+ });
332
+ };
333
+
334
+ /**
335
+ * @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded
336
+ * in the core registry so it can later disable any allowed package version
337
+ * via `disableVersionWithCorePauseCap`. Companion to the margin-side
338
+ * `MarginAdminContract.mintPauseCap`.
339
+ * @returns A function that takes a Transaction object and returns the new pause cap
340
+ */
341
+ mintCorePauseCap = () => (tx: Transaction) => {
342
+ return tx.moveCall({
343
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::mint_pause_cap`,
344
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
345
+ });
346
+ };
347
+
348
+ /**
349
+ * @description Revoke a previously minted `DeepbookCorePauseCap` by ID.
350
+ * @param {string} pauseCapId The ID of the core pause cap to revoke
351
+ * @returns A function that takes a Transaction object
352
+ */
353
+ revokeCorePauseCap = (pauseCapId: string) => (tx: Transaction) => {
354
+ tx.moveCall({
355
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::revoke_pause_cap`,
356
+ arguments: [
357
+ tx.object(this.#config.REGISTRY_ID),
358
+ tx.object(this.#adminCap()),
359
+ tx.pure.id(pauseCapId),
360
+ ],
361
+ });
362
+ };
363
+
364
+ /**
365
+ * @description Emergency kill switch — disable any allowed core package
366
+ * version (including the current one) using a held `DeepbookCorePauseCap`.
367
+ * Re-enable later via `enableVersion`.
368
+ * @param {number | bigint} version The version to disable
369
+ * @param {string} pauseCapId The ID of the core pause cap to authorize the disable
370
+ * @returns A function that takes a Transaction object
371
+ */
372
+ disableVersionWithCorePauseCap =
373
+ (version: number | bigint, pauseCapId: string) => (tx: Transaction) => {
374
+ tx.moveCall({
375
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version_pause_cap`,
376
+ arguments: [
377
+ tx.object(this.#config.REGISTRY_ID),
378
+ tx.pure.u64(version),
379
+ tx.object(pauseCapId),
380
+ ],
381
+ });
382
+ };
383
+
384
+ /**
385
+ * @description Get the set of allowed `DeepbookCorePauseCap` IDs from the
386
+ * core registry.
387
+ * @returns A function that takes a Transaction object and returns a `VecSet<ID>`
388
+ */
389
+ corePauseCaps = () => (tx: Transaction) => {
390
+ return tx.moveCall({
391
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::allowed_pause_caps`,
392
+ arguments: [tx.object(this.#config.REGISTRY_ID)],
331
393
  });
332
394
  };
333
395
  }
@@ -155,6 +155,85 @@ export class MarginAdminContract {
155
155
  });
156
156
  };
157
157
 
158
+ /**
159
+ * @description Set the price deviation tolerance for a pool. `tolerance` is
160
+ * in 9-decimal float scaling (1.0 = `FLOAT_SCALAR`); the SDK applies the
161
+ * scaling, so callers pass a human-readable fraction (e.g. `0.1` for 10%).
162
+ * Requires the pool's current price to have been initialized via
163
+ * `PoolProxyContract.updateCurrentPrice` first.
164
+ * @param {string} poolKey The key of the pool to update
165
+ * @param {number | bigint} tolerance Tolerance as a fraction (e.g. 0.1 for 10%)
166
+ * @returns A function that takes a Transaction object
167
+ */
168
+ setPriceTolerance = (poolKey: string, tolerance: number | bigint) => (tx: Transaction) => {
169
+ const pool = this.#config.getPool(poolKey);
170
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
171
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
172
+ tx.moveCall({
173
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_price_tolerance`,
174
+ arguments: [
175
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
176
+ tx.object(this.#marginAdminCap()),
177
+ tx.object(pool.address),
178
+ tx.pure.u64(convertRate(tolerance, FLOAT_SCALAR)),
179
+ tx.object.clock(),
180
+ ],
181
+ typeArguments: [baseCoin.type, quoteCoin.type],
182
+ });
183
+ };
184
+
185
+ /**
186
+ * @description Set the maximum acceptable Pyth price age (in milliseconds)
187
+ * for a pool. Requires the pool's current price to have been initialized
188
+ * via `PoolProxyContract.updateCurrentPrice` first.
189
+ * @param {string} poolKey The key of the pool to update
190
+ * @param {number | bigint} maxAgeMs Max age in milliseconds (raw u64)
191
+ * @returns A function that takes a Transaction object
192
+ */
193
+ setMaxPriceAge = (poolKey: string, maxAgeMs: number | bigint) => (tx: Transaction) => {
194
+ const pool = this.#config.getPool(poolKey);
195
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
196
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
197
+ tx.moveCall({
198
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_max_price_age`,
199
+ arguments: [
200
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
201
+ tx.object(this.#marginAdminCap()),
202
+ tx.object(pool.address),
203
+ tx.pure.u64(maxAgeMs),
204
+ tx.object.clock(),
205
+ ],
206
+ typeArguments: [baseCoin.type, quoteCoin.type],
207
+ });
208
+ };
209
+
210
+ /**
211
+ * @description Set the maximum lifetime (in milliseconds) of margin limit
212
+ * orders for a pool. `pool_proxy::place_limit_order_v2` and
213
+ * `place_reduce_only_limit_order_v2` clamp the user-supplied
214
+ * `expire_timestamp` to at most `now + max_order_ttl_ms`, bounding margin
215
+ * orders' exposure to stale-price exploitation.
216
+ * @param {string} poolKey The key of the pool to update
217
+ * @param {number | bigint} maxOrderTtlMs Max order TTL in milliseconds (raw u64)
218
+ * @returns A function that takes a Transaction object
219
+ */
220
+ setMaxOrderTtl = (poolKey: string, maxOrderTtlMs: number | bigint) => (tx: Transaction) => {
221
+ const pool = this.#config.getPool(poolKey);
222
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
223
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
224
+ tx.moveCall({
225
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::set_max_order_ttl`,
226
+ arguments: [
227
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
228
+ tx.object(this.#marginAdminCap()),
229
+ tx.object(pool.address),
230
+ tx.pure.u64(maxOrderTtlMs),
231
+ tx.object.clock(),
232
+ ],
233
+ typeArguments: [baseCoin.type, quoteCoin.type],
234
+ });
235
+ };
236
+
158
237
  /**
159
238
  * @description Add the PythConfig to the margin registry
160
239
  * @param {Transaction} tx The transaction object
@@ -99,13 +99,13 @@ export class MarginMaintainerContract {
99
99
  newMarginPoolConfig =
100
100
  (coinKey: string, marginPoolConfig: MarginPoolConfigParams) => (tx: Transaction) => {
101
101
  const coin = this.#config.getCoin(coinKey);
102
- const { supplyCap, maxUtilizationRate, referralSpread, minBorrow } = marginPoolConfig;
102
+ const { supplyCap, maxUtilizationRate, protocolSpread, minBorrow } = marginPoolConfig;
103
103
  return tx.moveCall({
104
104
  target: `${this.#config.MARGIN_PACKAGE_ID}::protocol_config::new_margin_pool_config`,
105
105
  arguments: [
106
106
  tx.pure.u64(convertQuantity(supplyCap, coin.scalar)),
107
107
  tx.pure.u64(convertRate(maxUtilizationRate, FLOAT_SCALAR)),
108
- tx.pure.u64(convertRate(referralSpread, FLOAT_SCALAR)),
108
+ tx.pure.u64(convertRate(protocolSpread, FLOAT_SCALAR)),
109
109
  tx.pure.u64(convertQuantity(minBorrow, coin.scalar)),
110
110
  ],
111
111
  });
@@ -133,7 +133,7 @@ export class MarginMaintainerContract {
133
133
  const {
134
134
  supplyCap,
135
135
  maxUtilizationRate,
136
- referralSpread,
136
+ protocolSpread,
137
137
  minBorrow,
138
138
  rateLimitCapacity,
139
139
  rateLimitRefillRatePerMs,
@@ -144,7 +144,7 @@ export class MarginMaintainerContract {
144
144
  arguments: [
145
145
  tx.pure.u64(convertQuantity(supplyCap, coin.scalar)),
146
146
  tx.pure.u64(convertRate(maxUtilizationRate, FLOAT_SCALAR)),
147
- tx.pure.u64(convertRate(referralSpread, FLOAT_SCALAR)),
147
+ tx.pure.u64(convertRate(protocolSpread, FLOAT_SCALAR)),
148
148
  tx.pure.u64(convertQuantity(minBorrow, coin.scalar)),
149
149
  tx.pure.u64(convertQuantity(rateLimitCapacity, coin.scalar)),
150
150
  tx.pure.u64(convertQuantity(rateLimitRefillRatePerMs, coin.scalar)),
@@ -5,7 +5,8 @@ import { coinWithBalance } from '@mysten/sui/transactions';
5
5
 
6
6
  import type { DeepBookConfig } from '../utils/config.js';
7
7
  import type { DepositParams, DepositDuringInitParams } from '../types/index.js';
8
- import { convertQuantity } from '../utils/conversion.js';
8
+ import { FLOAT_SCALAR } from '../utils/config.js';
9
+ import { convertPrice, convertQuantity } from '../utils/conversion.js';
9
10
 
10
11
  /**
11
12
  * MarginManagerContract class for managing MarginManager operations.
@@ -83,6 +84,43 @@ export class MarginManagerContract {
83
84
  });
84
85
  };
85
86
 
87
+ /**
88
+ * @description Register a margin manager back to the margin registry. Lets
89
+ * owners restore visibility of a manager that was unregistered by another
90
+ * platform.
91
+ * @param {string} managerKey The key to identify the margin manager
92
+ * @returns A function that takes a Transaction object
93
+ */
94
+ registerMarginManager = (managerKey: string) => (tx: Transaction) => {
95
+ const manager = this.#config.getMarginManager(managerKey);
96
+ const pool = this.#config.getPool(manager.poolKey);
97
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
98
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
99
+ tx.moveCall({
100
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::register_margin_manager`,
101
+ arguments: [tx.object(manager.address), tx.object(this.#config.MARGIN_REGISTRY_ID)],
102
+ typeArguments: [baseCoin.type, quoteCoin.type],
103
+ });
104
+ };
105
+
106
+ /**
107
+ * @description Unregister a margin manager from the margin registry. Aborts
108
+ * if the manager holds any outstanding debt or base/quote/DEEP balance.
109
+ * @param {string} managerKey The key to identify the margin manager
110
+ * @returns A function that takes a Transaction object
111
+ */
112
+ unregisterMarginManager = (managerKey: string) => (tx: Transaction) => {
113
+ const manager = this.#config.getMarginManager(managerKey);
114
+ const pool = this.#config.getPool(manager.poolKey);
115
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
116
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
117
+ tx.moveCall({
118
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::unregister_margin_manager`,
119
+ arguments: [tx.object(manager.address), tx.object(this.#config.MARGIN_REGISTRY_ID)],
120
+ typeArguments: [baseCoin.type, quoteCoin.type],
121
+ });
122
+ };
123
+
86
124
  /**
87
125
  * @description Deposit into a margin manager during initialization (before sharing).
88
126
  * Use this when you need to deposit funds into a newly created manager in the same transaction.
@@ -754,4 +792,209 @@ export class MarginManagerContract {
754
792
  typeArguments: [baseCoin.type, quoteCoin.type],
755
793
  });
756
794
  };
795
+
796
+ /**
797
+ * @description Get the underlying BalanceManager ID for a margin manager.
798
+ * Returns an ID (not a `&BalanceManager`), so it composes in PTBs unlike
799
+ * `balanceManager`.
800
+ * @param {string} poolKey The key to identify the pool
801
+ * @param {string} marginManagerId The ID of the margin manager
802
+ * @returns A function that takes a Transaction object
803
+ */
804
+ balanceManagerId = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
805
+ const pool = this.#config.getPool(poolKey);
806
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
807
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
808
+ return tx.moveCall({
809
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::balance_manager_id`,
810
+ arguments: [tx.object(marginManagerId)],
811
+ typeArguments: [baseCoin.type, quoteCoin.type],
812
+ });
813
+ };
814
+
815
+ /**
816
+ * @description Get the BalanceManager referral ID for a pool (Option<ID>).
817
+ * @param {string} poolKey The key to identify the pool
818
+ * @param {string} marginManagerId The ID of the margin manager
819
+ * @returns A function that takes a Transaction object
820
+ */
821
+ getBalanceManagerReferralId = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
822
+ const pool = this.#config.getPool(poolKey);
823
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
824
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
825
+ return tx.moveCall({
826
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::get_balance_manager_referral_id`,
827
+ arguments: [tx.object(marginManagerId), tx.pure.id(pool.address)],
828
+ typeArguments: [baseCoin.type, quoteCoin.type],
829
+ });
830
+ };
831
+
832
+ /**
833
+ * @description Check if the margin manager's account exists in the pool.
834
+ * @param {string} poolKey The key to identify the pool
835
+ * @param {string} marginManagerId The ID of the margin manager
836
+ * @returns A function that takes a Transaction object
837
+ */
838
+ accountExists = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
839
+ const pool = this.#config.getPool(poolKey);
840
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
841
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
842
+ return tx.moveCall({
843
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::account_exists`,
844
+ arguments: [tx.object(marginManagerId), tx.object(pool.address)],
845
+ typeArguments: [baseCoin.type, quoteCoin.type],
846
+ });
847
+ };
848
+
849
+ /**
850
+ * @description Get the pool account data for the margin manager.
851
+ * @param {string} poolKey The key to identify the pool
852
+ * @param {string} marginManagerId The ID of the margin manager
853
+ * @returns A function that takes a Transaction object
854
+ */
855
+ account = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
856
+ const pool = this.#config.getPool(poolKey);
857
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
858
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
859
+ return tx.moveCall({
860
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::account`,
861
+ arguments: [tx.object(marginManagerId), tx.object(pool.address)],
862
+ typeArguments: [baseCoin.type, quoteCoin.type],
863
+ });
864
+ };
865
+
866
+ /**
867
+ * @description Get the open order IDs for the margin manager's account in
868
+ * the pool.
869
+ * @param {string} poolKey The key to identify the pool
870
+ * @param {string} marginManagerId The ID of the margin manager
871
+ * @returns A function that takes a Transaction object
872
+ */
873
+ accountOpenOrders = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
874
+ const pool = this.#config.getPool(poolKey);
875
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
876
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
877
+ return tx.moveCall({
878
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::account_open_orders`,
879
+ arguments: [tx.object(marginManagerId), tx.object(pool.address)],
880
+ typeArguments: [baseCoin.type, quoteCoin.type],
881
+ });
882
+ };
883
+
884
+ /**
885
+ * @description Get full order details for the margin manager's account in
886
+ * the pool.
887
+ * @param {string} poolKey The key to identify the pool
888
+ * @param {string} marginManagerId The ID of the margin manager
889
+ * @returns A function that takes a Transaction object
890
+ */
891
+ getAccountOrderDetails = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
892
+ const pool = this.#config.getPool(poolKey);
893
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
894
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
895
+ return tx.moveCall({
896
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::get_account_order_details`,
897
+ arguments: [tx.object(marginManagerId), tx.object(pool.address)],
898
+ typeArguments: [baseCoin.type, quoteCoin.type],
899
+ });
900
+ };
901
+
902
+ /**
903
+ * @description Get locked balances (base, quote, deep) for the margin
904
+ * manager's account in the pool.
905
+ * @param {string} poolKey The key to identify the pool
906
+ * @param {string} marginManagerId The ID of the margin manager
907
+ * @returns A function that takes a Transaction object
908
+ */
909
+ lockedBalance = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
910
+ const pool = this.#config.getPool(poolKey);
911
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
912
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
913
+ return tx.moveCall({
914
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::locked_balance`,
915
+ arguments: [tx.object(marginManagerId), tx.object(pool.address)],
916
+ typeArguments: [baseCoin.type, quoteCoin.type],
917
+ });
918
+ };
919
+
920
+ /**
921
+ * @description Check whether a limit order can be placed given the
922
+ * manager's current state.
923
+ * @param {string} poolKey The key to identify the pool
924
+ * @param {string} marginManagerId The ID of the margin manager
925
+ * @param {number | bigint} price Limit price
926
+ * @param {number | bigint} quantity Order quantity (base units)
927
+ * @param {boolean} isBid True for bid, false for ask
928
+ * @param {boolean} payWithDeep Whether to pay fees in DEEP
929
+ * @param {number | bigint} expireTimestamp Order expiration timestamp (ms)
930
+ * @returns A function that takes a Transaction object
931
+ */
932
+ canPlaceLimitOrder =
933
+ (
934
+ poolKey: string,
935
+ marginManagerId: string,
936
+ price: number | bigint,
937
+ quantity: number | bigint,
938
+ isBid: boolean,
939
+ payWithDeep: boolean,
940
+ expireTimestamp: number | bigint,
941
+ ) =>
942
+ (tx: Transaction) => {
943
+ const pool = this.#config.getPool(poolKey);
944
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
945
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
946
+ const inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);
947
+ const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
948
+ return tx.moveCall({
949
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::can_place_limit_order`,
950
+ arguments: [
951
+ tx.object(marginManagerId),
952
+ tx.object(pool.address),
953
+ tx.pure.u64(inputPrice),
954
+ tx.pure.u64(inputQuantity),
955
+ tx.pure.bool(isBid),
956
+ tx.pure.bool(payWithDeep),
957
+ tx.pure.u64(expireTimestamp),
958
+ tx.object.clock(),
959
+ ],
960
+ typeArguments: [baseCoin.type, quoteCoin.type],
961
+ });
962
+ };
963
+
964
+ /**
965
+ * @description Check whether a market order can be placed given the
966
+ * manager's current state.
967
+ * @param {string} poolKey The key to identify the pool
968
+ * @param {string} marginManagerId The ID of the margin manager
969
+ * @param {number | bigint} quantity Order quantity (base units)
970
+ * @param {boolean} isBid True for bid, false for ask
971
+ * @param {boolean} payWithDeep Whether to pay fees in DEEP
972
+ * @returns A function that takes a Transaction object
973
+ */
974
+ canPlaceMarketOrder =
975
+ (
976
+ poolKey: string,
977
+ marginManagerId: string,
978
+ quantity: number | bigint,
979
+ isBid: boolean,
980
+ payWithDeep: boolean,
981
+ ) =>
982
+ (tx: Transaction) => {
983
+ const pool = this.#config.getPool(poolKey);
984
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
985
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
986
+ const inputQuantity = convertQuantity(quantity, baseCoin.scalar);
987
+ return tx.moveCall({
988
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::can_place_market_order`,
989
+ arguments: [
990
+ tx.object(marginManagerId),
991
+ tx.object(pool.address),
992
+ tx.pure.u64(inputQuantity),
993
+ tx.pure.bool(isBid),
994
+ tx.pure.bool(payWithDeep),
995
+ tx.object.clock(),
996
+ ],
997
+ typeArguments: [baseCoin.type, quoteCoin.type],
998
+ });
999
+ };
757
1000
  }
@@ -198,8 +198,11 @@ export class MarginTPSLContract {
198
198
  };
199
199
 
200
200
  /**
201
- * @description Execute conditional orders that have been triggered
202
- * This is a permissionless function that can be called by anyone
201
+ * @description Execute conditional orders that have been triggered.
202
+ * Permissionless anyone can call this. After the inner fill loop, the
203
+ * manager's post-trade `risk_ratio` is checked against
204
+ * `min_borrow_risk_ratio`; if any triggered fill breaches that floor, the
205
+ * whole txn aborts (no partial-state landing).
203
206
  * @param {string} managerAddress The address of the margin manager
204
207
  * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC')
205
208
  * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call
@@ -210,11 +213,15 @@ export class MarginTPSLContract {
210
213
  const pool = this.#config.getPool(poolKey);
211
214
  const baseCoin = this.#config.getCoin(pool.baseCoin);
212
215
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
216
+ const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
217
+ const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
213
218
  return tx.moveCall({
214
- target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::execute_conditional_orders`,
219
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::execute_conditional_orders_v2`,
215
220
  arguments: [
216
221
  tx.object(managerAddress),
217
222
  tx.object(pool.address),
223
+ tx.object(baseMarginPool.address),
224
+ tx.object(quoteMarginPool.address),
218
225
  tx.object(baseCoin.priceInfoObjectId!),
219
226
  tx.object(quoteCoin.priceInfoObjectId!),
220
227
  tx.object(this.#config.MARGIN_REGISTRY_ID),