@mysten/deepbook-v3 1.6.6 → 2.0.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 (88) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  3. package/dist/client.d.mts +11 -8
  4. package/dist/client.d.mts.map +1 -1
  5. package/dist/client.mjs +3 -2
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/contracts/deepbook/account.d.mts +18 -18
  8. package/dist/contracts/deepbook/account.d.mts.map +1 -1
  9. package/dist/contracts/deepbook/balances.d.mts +4 -4
  10. package/dist/contracts/deepbook/balances.d.mts.map +1 -1
  11. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  12. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  13. package/dist/contracts/deepbook_margin/margin_manager.mjs +1 -319
  14. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
  15. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs +386 -0
  16. package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -0
  17. package/dist/contracts/deepbook_margin/oracle.mjs +9 -0
  18. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -1
  19. package/dist/contracts/deepbook_margin/pool_proxy.mjs +1 -383
  20. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
  21. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs +340 -0
  22. package/dist/contracts/deepbook_margin/pool_proxy_upgraded.mjs.map +1 -0
  23. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +33 -17
  24. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -1
  25. package/dist/index.d.mts +4 -3
  26. package/dist/index.mjs +2 -2
  27. package/dist/pyth/PriceServiceConnection.d.mts +18 -3
  28. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -1
  29. package/dist/pyth/PriceServiceConnection.mjs +35 -4
  30. package/dist/pyth/PriceServiceConnection.mjs.map +1 -1
  31. package/dist/queries/priceFeedQueries.mjs +50 -18
  32. package/dist/queries/priceFeedQueries.mjs.map +1 -1
  33. package/dist/transactions/balanceManager.d.mts +12 -12
  34. package/dist/transactions/deepbook.d.mts +20 -20
  35. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  36. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  37. package/dist/transactions/marginAdmin.d.mts +7 -7
  38. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  39. package/dist/transactions/marginAdmin.mjs +2 -2
  40. package/dist/transactions/marginAdmin.mjs.map +1 -1
  41. package/dist/transactions/marginLiquidations.d.mts +3 -3
  42. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  43. package/dist/transactions/marginLiquidations.mjs +19 -7
  44. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  45. package/dist/transactions/marginMaintainer.d.mts +5 -5
  46. package/dist/transactions/marginManager.d.mts +32 -32
  47. package/dist/transactions/marginManager.d.mts.map +1 -1
  48. package/dist/transactions/marginManager.mjs +43 -34
  49. package/dist/transactions/marginManager.mjs.map +1 -1
  50. package/dist/transactions/marginPool.d.mts +18 -18
  51. package/dist/transactions/marginRegistry.d.mts +16 -16
  52. package/dist/transactions/marginTPSL.d.mts +10 -10
  53. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  54. package/dist/transactions/marginTPSL.mjs +19 -10
  55. package/dist/transactions/marginTPSL.mjs.map +1 -1
  56. package/dist/transactions/poolProxy.d.mts.map +1 -1
  57. package/dist/transactions/poolProxy.mjs +34 -27
  58. package/dist/transactions/poolProxy.mjs.map +1 -1
  59. package/dist/types/index.d.mts +16 -1
  60. package/dist/types/index.d.mts.map +1 -1
  61. package/dist/types/index.mjs.map +1 -1
  62. package/dist/utils/config.d.mts +30 -10
  63. package/dist/utils/config.d.mts.map +1 -1
  64. package/dist/utils/config.mjs +33 -4
  65. package/dist/utils/config.mjs.map +1 -1
  66. package/dist/utils/constants.d.mts +32 -1
  67. package/dist/utils/constants.d.mts.map +1 -1
  68. package/dist/utils/constants.mjs +54 -23
  69. package/dist/utils/constants.mjs.map +1 -1
  70. package/package.json +2 -2
  71. package/src/client.ts +9 -1
  72. package/src/contracts/deepbook_margin/margin_manager.ts +140 -10
  73. package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +651 -0
  74. package/src/contracts/deepbook_margin/oracle.ts +59 -0
  75. package/src/contracts/deepbook_margin/pool_proxy.ts +600 -584
  76. package/src/contracts/deepbook_margin/pool_proxy_upgraded.ts +614 -0
  77. package/src/contracts/margin_liquidation/liquidation_vault.ts +142 -0
  78. package/src/index.ts +4 -0
  79. package/src/pyth/PriceServiceConnection.ts +69 -8
  80. package/src/queries/priceFeedQueries.ts +74 -24
  81. package/src/transactions/marginAdmin.ts +2 -4
  82. package/src/transactions/marginLiquidations.ts +20 -6
  83. package/src/transactions/marginManager.ts +43 -33
  84. package/src/transactions/marginTPSL.ts +19 -9
  85. package/src/transactions/poolProxy.ts +34 -30
  86. package/src/types/index.ts +16 -0
  87. package/src/utils/config.ts +69 -9
  88. package/src/utils/constants.ts +88 -25
@@ -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 VAAs of given price IDs.
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 encoded VAAs.
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;EADI;;;;;;cAQA,QAAA,UAAkB,MAAA,GAAS,4BAAA;EAgBY;;;;;;EAA7C,aAAA,CAAc,QAAA,EAAU,SAAA,KAAc,OAAA;AAAA"}
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 VAAs of given price IDs.
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 encoded VAAs.
33
+ * @returns Array of base64-encoded update messages.
27
34
  */
28
35
  async getLatestVaas(priceIds) {
29
- return (await this.httpClient.get("/api/latest_vaas", { params: { ids: priceIds } })).data;
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 VAAs of given price IDs.\n\t *\n\t * @param priceIds Array of hex-encoded price IDs.\n\t * @returns Array of base64 encoded VAAs.\n\t */\n\tasync getLatestVaas(priceIds: HexString[]): Promise<string[]> {\n\t\tconst response = await this.httpClient.get('/api/latest_vaas', {\n\t\t\tparams: {\n\t\t\t\tids: priceIds,\n\t\t\t},\n\t\t});\n\t\treturn response.data;\n\t}\n}\n"],"mappings":";;;;AAeA,IAAa,yBAAb,MAAoC;;;;;;;CAQnC,YAAY,UAAkB,QAAuC;AACpE,OAAK,aAAa,MAAM,OAAO;GAC9B,SAAS;GACT,SAAS,QAAQ,WAAW;GAC5B,CAAC;AACF,aAAW,KAAK,YAAY;GAC3B,SAAS,QAAQ,eAAe;GAChC,YAAY,WAAW;GACvB,CAAC;;;;;;;;CAQH,MAAM,cAAc,UAA0C;AAM7D,UALiB,MAAM,KAAK,WAAW,IAAI,oBAAoB,EAC9D,QAAQ,EACP,KAAK,UACL,EACD,CAAC,EACc"}
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 await this.#ctx.config.getCoin(coinKey).priceInfoObjectId;
16
- const connection = new SuiPriceServiceConnection(this.#ctx.config.network === "testnet" ? "https://hermes-beta.pyth.network" : "https://hermes.pyth.network");
17
- const priceIDs = [this.#ctx.config.getCoin(coinKey).feed];
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.wormholeStateId;
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.getCoin(coinKey).priceInfoObjectId;
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 feedIdToCoinKey = {};
86
+ const feedIdToCoinKeys = {};
54
87
  for (const coinKey of staleCoinKeys) {
55
- const feedId = this.#ctx.config.getCoin(coinKey).feed;
56
- staleFeedIds.push(feedId);
57
- feedIdToCoinKey[feedId] = coinKey;
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 new SuiPriceServiceConnection(this.#ctx.config.network === "testnet" ? "https://hermes-beta.pyth.network" : "https://hermes.pyth.network").getPriceFeedsUpdateData(staleFeedIds);
60
- const wormholeStateId = this.#ctx.config.pyth.wormholeStateId;
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.getCoin(coinKey).priceInfoObjectId;
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 await this.#ctx.config.getCoin(coinKey).priceInfoObjectId!;\n\t\t}\n\n\t\tconst endpoint =\n\t\t\tthis.#ctx.config.network === 'testnet'\n\t\t\t\t? 'https://hermes-beta.pyth.network'\n\t\t\t\t: 'https://hermes.pyth.network';\n\t\tconst connection = new SuiPriceServiceConnection(endpoint);\n\n\t\tconst priceIDs = [this.#ctx.config.getCoin(coinKey).feed!];\n\n\t\tconst priceUpdateData = await connection.getPriceFeedsUpdateData(priceIDs);\n\n\t\tconst wormholeStateId = this.#ctx.config.pyth.wormholeStateId;\n\t\tconst pythStateId = this.#ctx.config.pyth.pythStateId;\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.getCoin(coinKey).priceInfoObjectId!;\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\tconst staleFeedIds: string[] = [];\n\t\tconst feedIdToCoinKey: Record<string, string> = {};\n\t\tfor (const coinKey of staleCoinKeys) {\n\t\t\tconst feedId = this.#ctx.config.getCoin(coinKey).feed!;\n\t\t\tstaleFeedIds.push(feedId);\n\t\t\tfeedIdToCoinKey[feedId] = coinKey;\n\t\t}\n\n\t\tconst endpoint =\n\t\t\tthis.#ctx.config.network === 'testnet'\n\t\t\t\t? 'https://hermes-beta.pyth.network'\n\t\t\t\t: 'https://hermes.pyth.network';\n\t\tconst connection = new SuiPriceServiceConnection(endpoint);\n\n\t\tconst priceUpdateData = await connection.getPriceFeedsUpdateData(staleFeedIds);\n\n\t\tconst wormholeStateId = this.#ctx.config.pyth.wormholeStateId;\n\t\tconst pythStateId = this.#ctx.config.pyth.pythStateId;\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\tconst coinKey = feedIdToCoinKey[staleFeedIds[i]];\n\t\t\tresult[coinKey] = updatedObjectIds[i];\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.getCoin(coinKey).priceInfoObjectId!;\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":";;;;;AAUA,IAAa,mBAAb,MAA8B;CAC7B;CAEA,YAAY,KAAmB;AAC9B,QAAKA,MAAO;;CAGb,MAAM,mBAAmB,IAAiB,SAAkC;AAC3E,QAAKA,IAAK,OAAO,aAAa;EAC9B,MAAM,cAAc,KAAK,KAAK;EAC9B,MAAM,qBAAqB,MAAM,KAAK,sBAAsB,Q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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":";;;;;;;AAYA,IAAa,mBAAb,MAA8B;CAC7B;CAEA,YAAY,KAAmB;AAC9B,QAAKA,MAAO;;;;;;;;;;;;;;;;;;CAmBb,kBAA0B;EACzB,MAAM,EAAE,gBAAgB,gBAAgB,MAAKA,IAAK,OAAO;AACzD,MAAI,eACH,QAAO;AAGR,MAAI,YACH,QAAO;AAER,MAAI,sBACH,QAAO;AAGR,QAAM,IAAI,mBACT,mQACA;;;;;;;CAQF,cAAyC;EACxC,MAAM,EAAE,gBAAgB,MAAKA,IAAK,OAAO;AACzC,SAAO,IAAI,0BACV,MAAKC,gBAAiB,EACtB,cAAc,E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- import * as _mysten_sui_transactions5 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions2 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) => _mysten_sui_transactions5.TransactionResult;
24
+ createBalanceManagerWithOwner: (ownerAddress: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
68
+ generateProof: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
74
+ generateProofAsOwner: (managerId: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
81
+ generateProofAsTrader: (managerId: string, tradeCapId: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
87
+ mintTradeCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
93
+ mintDepositCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
99
+ mintWithdrawalCap: (managerKey: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
115
+ withdrawWithCap: (managerKey: string, coinKey: string, amountToWithdraw: number) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
150
+ balanceManagerReferralOwner: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
156
+ balanceManagerReferralPoolId: (referralId: string) => (tx: Transaction) => _mysten_sui_transactions2.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) => _mysten_sui_transactions5.TransactionResult;
163
+ getBalanceManagerReferralId: (managerKey: string, poolKey: string) => (tx: Transaction) => _mysten_sui_transactions2.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,6 +1,6 @@
1
1
  import { CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, CreatePermissionlessPoolParams, PlaceLimitOrderParams, PlaceMarketOrderParams, SwapParams, SwapWithManagerParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions16 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions13 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/deepbook.d.ts
@@ -380,40 +380,40 @@ declare class DeepBookContract {
380
380
  * @param {string} referral The referral (DeepBookPoolReferral) to get the balances for
381
381
  * @returns A function that takes a Transaction object
382
382
  */
383
- getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
383
+ getPoolReferralBalances: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
384
384
  /**
385
385
  * @description Get the multiplier for a referral (DeepBookPoolReferral)
386
386
  * @param {string} poolKey The key to identify the pool
387
387
  * @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
388
388
  * @returns A function that takes a Transaction object
389
389
  */
390
- poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
390
+ poolReferralMultiplier: (poolKey: string, referral: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
391
391
  /**
392
392
  * @description Check if a pool is a stable pool
393
393
  * @param {string} poolKey The key to identify the pool
394
394
  * @returns A function that takes a Transaction object
395
395
  */
396
- stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
396
+ stablePool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
397
397
  /**
398
398
  * @description Check if a pool is registered
399
399
  * @param {string} poolKey The key to identify the pool
400
400
  * @returns A function that takes a Transaction object
401
401
  */
402
- registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
402
+ registeredPool: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
403
403
  /**
404
404
  * @description Get the quote quantity out for a given base quantity using input token as fee
405
405
  * @param {string} poolKey The key to identify the pool
406
406
  * @param {number} baseQuantity Base quantity to convert
407
407
  * @returns A function that takes a Transaction object
408
408
  */
409
- getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
409
+ getQuoteQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
410
410
  /**
411
411
  * @description Get the base quantity out for a given quote quantity using input token as fee
412
412
  * @param {string} poolKey The key to identify the pool
413
413
  * @param {number} quoteQuantity Quote quantity to convert
414
414
  * @returns A function that takes a Transaction object
415
415
  */
416
- getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
416
+ getBaseQuantityOutInputFee: (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
417
417
  /**
418
418
  * @description Get the quantity out for a given base or quote quantity using input token as fee
419
419
  * @param {string} poolKey The key to identify the pool
@@ -421,7 +421,7 @@ declare class DeepBookContract {
421
421
  * @param {number} quoteQuantity Quote quantity to convert
422
422
  * @returns A function that takes a Transaction object
423
423
  */
424
- getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
424
+ getQuantityOutInputFee: (poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
425
425
  /**
426
426
  * @description Get the base quantity needed to receive a target quote quantity
427
427
  * @param {string} poolKey The key to identify the pool
@@ -429,7 +429,7 @@ declare class DeepBookContract {
429
429
  * @param {boolean} payWithDeep Whether to pay fees with DEEP
430
430
  * @returns A function that takes a Transaction object
431
431
  */
432
- getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
432
+ getBaseQuantityIn: (poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
433
433
  /**
434
434
  * @description Get the quote quantity needed to receive a target base quantity
435
435
  * @param {string} poolKey The key to identify the pool
@@ -437,14 +437,14 @@ declare class DeepBookContract {
437
437
  * @param {boolean} payWithDeep Whether to pay fees with DEEP
438
438
  * @returns A function that takes a Transaction object
439
439
  */
440
- getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
440
+ getQuoteQuantityIn: (poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
441
441
  /**
442
442
  * @description Get account order details for a balance manager
443
443
  * @param {string} poolKey The key to identify the pool
444
444
  * @param {string} managerKey Key of the balance manager
445
445
  * @returns A function that takes a Transaction object
446
446
  */
447
- getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
447
+ getAccountOrderDetails: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
448
448
  /**
449
449
  * @description Get the DEEP required for an order
450
450
  * @param {string} poolKey The key to identify the pool
@@ -452,51 +452,51 @@ declare class DeepBookContract {
452
452
  * @param {number} price Price
453
453
  * @returns A function that takes a Transaction object
454
454
  */
455
- getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
455
+ getOrderDeepRequired: (poolKey: string, baseQuantity: number | bigint, price: number | bigint) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
456
456
  /**
457
457
  * @description Check if account exists for a balance manager
458
458
  * @param {string} poolKey The key to identify the pool
459
459
  * @param {string} managerKey Key of the balance manager
460
460
  * @returns A function that takes a Transaction object
461
461
  */
462
- accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
462
+ accountExists: (poolKey: string, managerKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
463
463
  /**
464
464
  * @description Get the next epoch trade parameters for a pool
465
465
  * @param {string} poolKey The key to identify the pool
466
466
  * @returns A function that takes a Transaction object
467
467
  */
468
- poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
468
+ poolTradeParamsNext: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
469
469
  /**
470
470
  * @description Get the quorum for a pool
471
471
  * @param {string} poolKey The key to identify the pool
472
472
  * @returns A function that takes a Transaction object
473
473
  */
474
- quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
474
+ quorum: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
475
475
  /**
476
476
  * @description Get the pool ID
477
477
  * @param {string} poolKey The key to identify the pool
478
478
  * @returns A function that takes a Transaction object
479
479
  */
480
- poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
480
+ poolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
481
481
  /**
482
482
  * @description Check if a limit order can be placed
483
483
  * @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity
484
484
  * @returns A function that takes a Transaction object
485
485
  */
486
- canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
486
+ canPlaceLimitOrder: (params: CanPlaceLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
487
487
  /**
488
488
  * @description Check if a market order can be placed
489
489
  * @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity
490
490
  * @returns A function that takes a Transaction object
491
491
  */
492
- canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
492
+ canPlaceMarketOrder: (params: CanPlaceMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
493
493
  /**
494
494
  * @description Check if market order params are valid
495
495
  * @param {string} poolKey The key to identify the pool
496
496
  * @param {number} quantity Quantity
497
497
  * @returns A function that takes a Transaction object
498
498
  */
499
- checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
499
+ checkMarketOrderParams: (poolKey: string, quantity: number | bigint) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
500
500
  /**
501
501
  * @description Check if limit order params are valid
502
502
  * @param {string} poolKey The key to identify the pool
@@ -505,7 +505,7 @@ declare class DeepBookContract {
505
505
  * @param {number} expireTimestamp Expiration timestamp
506
506
  * @returns A function that takes a Transaction object
507
507
  */
508
- checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions16.TransactionResult;
508
+ checkLimitOrderParams: (poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) => (tx: Transaction) => _mysten_sui_transactions13.TransactionResult;
509
509
  }
510
510
  //#endregion
511
511
  export { DeepBookContract };
@@ -1,6 +1,6 @@
1
1
  import { CreatePoolAdminParams, SetEwmaParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions35 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/deepbookAdmin.d.ts
@@ -104,7 +104,7 @@ declare class DeepBookAdminContract {
104
104
  * @description Deauthorize the MarginApp by removing its authorization key
105
105
  * @returns A function that takes a Transaction object and returns a bool
106
106
  */
107
- deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions35.TransactionResult;
107
+ deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
108
108
  /**
109
109
  * @description Mint a `DeepbookCorePauseCap`. The new cap's ID is recorded
110
110
  * in the core registry so it can later disable any allowed package version
@@ -112,7 +112,7 @@ declare class DeepBookAdminContract {
112
112
  * `MarginAdminContract.mintPauseCap`.
113
113
  * @returns A function that takes a Transaction object and returns the new pause cap
114
114
  */
115
- mintCorePauseCap: () => (tx: Transaction) => _mysten_sui_transactions35.TransactionResult;
115
+ mintCorePauseCap: () => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
116
116
  /**
117
117
  * @description Revoke a previously minted `DeepbookCorePauseCap` by ID.
118
118
  * @param {string} pauseCapId The ID of the core pause cap to revoke
@@ -133,7 +133,7 @@ declare class DeepBookAdminContract {
133
133
  * core registry.
134
134
  * @returns A function that takes a Transaction object and returns a `VecSet<ID>`
135
135
  */
136
- corePauseCaps: () => (tx: Transaction) => _mysten_sui_transactions35.TransactionResult;
136
+ corePauseCaps: () => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
137
137
  }
138
138
  //#endregion
139
139
  export { DeepBookAdminContract };
@@ -1 +1 @@
1
- {"version":3,"file":"deepbookAdmin.d.mts","names":[],"sources":["../../src/transactions/deepbookAdmin.ts"],"mappings":";;;;;;;;;cAea,qBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAyD4B;;;;;EApChD,eAAA,GAAmB,MAAA,EAAQ,qBAAA,MAA2B,EAAA,EAAI,WAAA;EA0IP;;;;;EAtGnD,mBAAA,GAAuB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA6Na;;;;;EAvM7D,qBAAA,GAAyB,OAAA,cAAqB,EAAA,EAAI,WAAA;EAsQA;;;;;EAhPlD,aAAA,GAAiB,OAAA,cAAqB,EAAA,EAAI,WAAA;;;;;;EAc1C,cAAA,GAAkB,OAAA,cAAqB,EAAA,EAAI,WAAA;EA9FxB;;;;;EA4GnB,kBAAA,GAAsB,eAAA,cAA6B,EAAA,EAAI,WAAA;EAxEX;;;;;EAsF5C,aAAA,GAAiB,aAAA,cAA2B,EAAA,EAAI,WAAA;EA1C/B;;;;;EA0DjB,gBAAA,GAAoB,aAAA,cAA2B,EAAA,EAAI,WAAA;EA5CZ;;;;;;EA6DvC,cAAA,GAAkB,OAAA,UAAiB,WAAA,cAAyB,EAAA,EAAI,WAAA;EAjChB;;;;;;;EA4DhD,gBAAA,GACE,OAAA,UAAiB,UAAA,UAAoB,UAAA,cAAwB,EAAA,EAAI,WAAA;EA5BhC;;;;EAyDnC,qBAAA,SAA+B,EAAA,EAAI,WAAA;EA7BhB;;;;;;EA4CnB,aAAA,GAAiB,OAAA,UAAiB,MAAA,EAAQ,aA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GAAkB,OAAA,UAAiB,WAAA,cAAyB,EAAA,EAAI,WAAA;EAjChB;;;;;;;EA4DhD,gBAAA,GACE,OAAA,UAAiB,UAAA,UAAoB,UAAA,cAAwB,EAAA,EAAI,WAAA;EA5BhC;;;;EAyDnC,qBAAA,SAA+B,EAAA,EAAI,WAAA;EA7BhB;;;;;;EA4CnB,aAAA,GAAiB,OAAA,UAAiB,MAAA,EAAQ,aAAA,MAAmB,EAAA,EAAI,WAAA;EAAjE;;;;;;EA8BA,eAAA,GAAmB,OAAA,UAAiB,MAAA,eAAqB,EAAA,EAAI,WAAA;EAA1C;;;;EAkBnB,kBAAA,SAA4B,EAAA,EAAI,WAAA;EAAA;;;;EAchC,oBAAA,SAA8B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAAA;;;;;;;EAiB7C,gBAAA,SAA0B,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;EAcK;;;;;EAA9C,kBAAA,GAAsB,UAAA,cAAwB,EAAA,EAAI,WAAA;EAgClD;;;;;;;;EAfA,8BAAA,GACE,OAAA,mBAA0B,UAAA,cAAwB,EAAA,EAAI,WAAA;;;;;;EAcxD,aAAA,SAAuB,EAAA,EAAI,WAAA,KAAW,yBAAA,CAAA,iBAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { PoolConfigParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions0 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions76 from "@mysten/sui/transactions";
4
4
  import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginAdmin.d.ts
@@ -17,7 +17,7 @@ declare class MarginAdminContract {
17
17
  * @description Mint a maintainer cap
18
18
  * @returns A function that takes a Transaction object
19
19
  */
20
- mintMaintainerCap: () => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
20
+ mintMaintainerCap: () => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
21
21
  /**
22
22
  * @description Revoke a maintainer cap
23
23
  * @returns A function that takes a Transaction object
@@ -121,7 +121,7 @@ declare class MarginAdminContract {
121
121
  * @param {PoolConfigParams} poolConfigParams The parameters for the pool config
122
122
  * @returns A function that takes a Transaction object
123
123
  */
124
- newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
124
+ newPoolConfig: (poolKey: string, poolConfigParams: PoolConfigParams) => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
125
125
  /**
126
126
  * @description Create a new pool config with leverage
127
127
  * @param {string} poolKey The key to identify the pool
@@ -136,7 +136,7 @@ declare class MarginAdminContract {
136
136
  * @param {number} maxEwmaDifferenceBps The maximum EWMA difference in basis points
137
137
  * @returns A function that takes a Transaction object
138
138
  */
139
- newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
139
+ newCoinTypeData: (coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number) => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
140
140
  /**
141
141
  * @description Create a new Pyth config
142
142
  * @param {Array<{coinKey: string, maxConfBps: number, maxEwmaDifferenceBps: number}>} coinSetups The coins with their oracle config to be added to the Pyth config
@@ -147,12 +147,12 @@ declare class MarginAdminContract {
147
147
  coinKey: string;
148
148
  maxConfBps: number;
149
149
  maxEwmaDifferenceBps: number;
150
- }>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
150
+ }>, maxAgeSeconds: number) => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
151
151
  /**
152
152
  * @description Mint a pause cap
153
153
  * @returns A function that takes a Transaction object
154
154
  */
155
- mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
155
+ mintPauseCap: () => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
156
156
  /**
157
157
  * @description Revoke a pause cap
158
158
  * @param {string} pauseCapId The ID of the pause cap to revoke
@@ -172,7 +172,7 @@ declare class MarginAdminContract {
172
172
  * @param {string} coinKey The key to identify the margin pool
173
173
  * @returns A function that takes a Transaction object and returns a Coin<Asset>
174
174
  */
175
- adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions0.TransactionResult;
175
+ adminWithdrawDefaultReferralFees: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions76.TransactionResult;
176
176
  }
177
177
  //#endregion
178
178
  export { MarginAdminContract };