@mysten/deepbook-v3 1.3.0 → 1.3.2

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 (84) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/contracts/deepbook/account.d.mts +1 -1
  3. package/dist/contracts/deepbook/account.mjs.map +1 -1
  4. package/dist/contracts/deepbook/deep_price.d.mts +1 -1
  5. package/dist/contracts/deepbook/deep_price.mjs.map +1 -1
  6. package/dist/contracts/deepbook/order.d.mts +1 -1
  7. package/dist/contracts/deepbook/order.mjs.map +1 -1
  8. package/dist/contracts/pyth/data_source.mjs.map +1 -1
  9. package/dist/contracts/pyth/i64.mjs.map +1 -1
  10. package/dist/contracts/pyth/price.mjs.map +1 -1
  11. package/dist/contracts/pyth/price_feed.mjs.map +1 -1
  12. package/dist/contracts/pyth/price_identifier.mjs.map +1 -1
  13. package/dist/contracts/pyth/price_info.mjs.map +1 -1
  14. package/dist/contracts/pyth/state.mjs.map +1 -1
  15. package/dist/contracts/utils/index.d.mts +4 -4
  16. package/dist/contracts/utils/index.d.mts.map +1 -1
  17. package/dist/contracts/utils/index.mjs.map +1 -1
  18. package/dist/queries/accountQueries.mjs +3 -0
  19. package/dist/queries/accountQueries.mjs.map +1 -1
  20. package/dist/queries/balanceManagerQueries.mjs +5 -0
  21. package/dist/queries/balanceManagerQueries.mjs.map +1 -1
  22. package/dist/queries/marginManagerQueries.mjs +15 -0
  23. package/dist/queries/marginManagerQueries.mjs.map +1 -1
  24. package/dist/queries/marginPoolQueries.mjs +14 -0
  25. package/dist/queries/marginPoolQueries.mjs.map +1 -1
  26. package/dist/queries/orderQueries.mjs +7 -0
  27. package/dist/queries/orderQueries.mjs.map +1 -1
  28. package/dist/queries/poolQueries.mjs +15 -0
  29. package/dist/queries/poolQueries.mjs.map +1 -1
  30. package/dist/queries/quantityQueries.mjs +9 -0
  31. package/dist/queries/quantityQueries.mjs.map +1 -1
  32. package/dist/queries/referralQueries.mjs +5 -0
  33. package/dist/queries/referralQueries.mjs.map +1 -1
  34. package/dist/queries/registryQueries.mjs +12 -0
  35. package/dist/queries/registryQueries.mjs.map +1 -1
  36. package/dist/queries/tpslQueries.mjs +3 -0
  37. package/dist/queries/tpslQueries.mjs.map +1 -1
  38. package/dist/transactions/marginAdmin.d.mts +7 -7
  39. package/dist/transactions/marginLiquidations.d.mts +3 -3
  40. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  41. package/dist/transactions/marginMaintainer.d.mts +5 -5
  42. package/dist/transactions/marginManager.d.mts +23 -23
  43. package/dist/transactions/marginRegistry.d.mts +15 -15
  44. package/package.json +4 -4
  45. package/src/contracts/deepbook/account.ts +20 -20
  46. package/src/contracts/deepbook/balance_manager.ts +3 -3
  47. package/src/contracts/deepbook/deep_price.ts +6 -6
  48. package/src/contracts/deepbook/fill.ts +34 -34
  49. package/src/contracts/deepbook/math.ts +2 -2
  50. package/src/contracts/deepbook/order.ts +24 -24
  51. package/src/contracts/deepbook/order_info.ts +46 -46
  52. package/src/contracts/deepbook/order_query.ts +5 -5
  53. package/src/contracts/deepbook/pool.ts +119 -33
  54. package/src/contracts/deepbook/registry.ts +3 -3
  55. package/src/contracts/pyth/batch_price_attestation.ts +5 -5
  56. package/src/contracts/pyth/contract_upgrade.ts +3 -3
  57. package/src/contracts/pyth/data_source.ts +4 -4
  58. package/src/contracts/pyth/deserialize.ts +8 -8
  59. package/src/contracts/pyth/governance.ts +7 -7
  60. package/src/contracts/pyth/governance_action.ts +2 -2
  61. package/src/contracts/pyth/governance_instruction.ts +6 -6
  62. package/src/contracts/pyth/hot_potato_vector.ts +5 -5
  63. package/src/contracts/pyth/i64.ts +4 -4
  64. package/src/contracts/pyth/merkle_tree.ts +3 -7
  65. package/src/contracts/pyth/migrate.ts +2 -2
  66. package/src/contracts/pyth/price.ts +7 -7
  67. package/src/contracts/pyth/price_feed.ts +7 -11
  68. package/src/contracts/pyth/price_identifier.ts +3 -3
  69. package/src/contracts/pyth/price_info.ts +9 -9
  70. package/src/contracts/pyth/price_status.ts +2 -2
  71. package/src/contracts/pyth/pyth.ts +12 -12
  72. package/src/contracts/pyth/set.ts +4 -4
  73. package/src/contracts/pyth/state.ts +5 -5
  74. package/src/contracts/utils/index.ts +7 -11
  75. package/src/queries/accountQueries.ts +3 -0
  76. package/src/queries/balanceManagerQueries.ts +5 -0
  77. package/src/queries/marginManagerQueries.ts +15 -0
  78. package/src/queries/marginPoolQueries.ts +14 -0
  79. package/src/queries/orderQueries.ts +7 -0
  80. package/src/queries/poolQueries.ts +15 -0
  81. package/src/queries/quantityQueries.ts +9 -0
  82. package/src/queries/referralQueries.ts +5 -0
  83. package/src/queries/registryQueries.ts +12 -0
  84. package/src/queries/tpslQueries.ts +3 -0
@@ -26,6 +26,7 @@ export class MarginManagerQueries {
26
26
  async getMarginManagerOwner(marginManagerKey: string): Promise<string> {
27
27
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
28
28
  const tx = new Transaction();
29
+ tx.setSender(this.#ctx.address);
29
30
  tx.add(this.#ctx.marginManager.ownerByPoolKey(manager.poolKey, manager.address));
30
31
 
31
32
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -40,6 +41,7 @@ export class MarginManagerQueries {
40
41
  async getMarginManagerDeepbookPool(marginManagerKey: string): Promise<string> {
41
42
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
42
43
  const tx = new Transaction();
44
+ tx.setSender(this.#ctx.address);
43
45
  tx.add(this.#ctx.marginManager.deepbookPool(manager.poolKey, manager.address));
44
46
 
45
47
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -54,6 +56,7 @@ export class MarginManagerQueries {
54
56
  async getMarginManagerMarginPoolId(marginManagerKey: string): Promise<string | null> {
55
57
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
56
58
  const tx = new Transaction();
59
+ tx.setSender(this.#ctx.address);
57
60
  tx.add(this.#ctx.marginManager.marginPoolId(manager.poolKey, manager.address));
58
61
 
59
62
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -69,6 +72,7 @@ export class MarginManagerQueries {
69
72
  async getMarginManagerBorrowedShares(marginManagerKey: string): Promise<BorrowedShares> {
70
73
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
71
74
  const tx = new Transaction();
75
+ tx.setSender(this.#ctx.address);
72
76
  tx.add(this.#ctx.marginManager.borrowedShares(manager.poolKey, manager.address));
73
77
 
74
78
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -87,6 +91,7 @@ export class MarginManagerQueries {
87
91
  async getMarginManagerBorrowedBaseShares(marginManagerKey: string): Promise<string> {
88
92
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
89
93
  const tx = new Transaction();
94
+ tx.setSender(this.#ctx.address);
90
95
  tx.add(this.#ctx.marginManager.borrowedBaseShares(manager.poolKey, manager.address));
91
96
 
92
97
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -101,6 +106,7 @@ export class MarginManagerQueries {
101
106
  async getMarginManagerBorrowedQuoteShares(marginManagerKey: string): Promise<string> {
102
107
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
103
108
  const tx = new Transaction();
109
+ tx.setSender(this.#ctx.address);
104
110
  tx.add(this.#ctx.marginManager.borrowedQuoteShares(manager.poolKey, manager.address));
105
111
 
106
112
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -115,6 +121,7 @@ export class MarginManagerQueries {
115
121
  async getMarginManagerHasBaseDebt(marginManagerKey: string): Promise<boolean> {
116
122
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
117
123
  const tx = new Transaction();
124
+ tx.setSender(this.#ctx.address);
118
125
  tx.add(this.#ctx.marginManager.hasBaseDebt(manager.poolKey, manager.address));
119
126
 
120
127
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -154,6 +161,7 @@ export class MarginManagerQueries {
154
161
  ): Promise<MarginManagerAssets> {
155
162
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
156
163
  const tx = new Transaction();
164
+ tx.setSender(this.#ctx.address);
157
165
  tx.add(this.#ctx.marginManager.calculateAssets(manager.poolKey, manager.address));
158
166
 
159
167
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -192,6 +200,7 @@ export class MarginManagerQueries {
192
200
  const debtCoinKey = hasBaseDebt ? pool.baseCoin : pool.quoteCoin;
193
201
 
194
202
  const tx = new Transaction();
203
+ tx.setSender(this.#ctx.address);
195
204
  tx.add(this.#ctx.marginManager.calculateDebts(manager.poolKey, debtCoinKey, manager.address));
196
205
 
197
206
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -229,6 +238,7 @@ export class MarginManagerQueries {
229
238
  ): Promise<MarginManagerState> {
230
239
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
231
240
  const tx = new Transaction();
241
+ tx.setSender(this.#ctx.address);
232
242
  tx.add(this.#ctx.marginManager.managerState(manager.poolKey, manager.address));
233
243
 
234
244
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -322,6 +332,7 @@ export class MarginManagerQueries {
322
332
  }
323
333
 
324
334
  const tx = new Transaction();
335
+ tx.setSender(this.#ctx.address);
325
336
 
326
337
  for (const [managerId, poolKey] of entries) {
327
338
  tx.add(this.#ctx.marginManager.managerState(poolKey, managerId));
@@ -419,6 +430,7 @@ export class MarginManagerQueries {
419
430
  ): Promise<string> {
420
431
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
421
432
  const tx = new Transaction();
433
+ tx.setSender(this.#ctx.address);
422
434
  tx.add(this.#ctx.marginManager.baseBalance(manager.poolKey, manager.address));
423
435
 
424
436
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -449,6 +461,7 @@ export class MarginManagerQueries {
449
461
  ): Promise<string> {
450
462
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
451
463
  const tx = new Transaction();
464
+ tx.setSender(this.#ctx.address);
452
465
  tx.add(this.#ctx.marginManager.quoteBalance(manager.poolKey, manager.address));
453
466
 
454
467
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -479,6 +492,7 @@ export class MarginManagerQueries {
479
492
  ): Promise<string> {
480
493
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
481
494
  const tx = new Transaction();
495
+ tx.setSender(this.#ctx.address);
482
496
  tx.add(this.#ctx.marginManager.deepBalance(manager.poolKey, manager.address));
483
497
 
484
498
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -512,6 +526,7 @@ export class MarginManagerQueries {
512
526
  }
513
527
 
514
528
  const tx = new Transaction();
529
+ tx.setSender(this.#ctx.address);
515
530
 
516
531
  for (const [managerId, poolKey] of entries) {
517
532
  tx.add(this.#ctx.marginManager.baseBalance(poolKey, managerId));
@@ -17,6 +17,7 @@ export class MarginPoolQueries {
17
17
 
18
18
  async getMarginPoolId(coinKey: string): Promise<string> {
19
19
  const tx = new Transaction();
20
+ tx.setSender(this.#ctx.address);
20
21
  tx.add(this.#ctx.marginPool.getId(coinKey));
21
22
 
22
23
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -30,6 +31,7 @@ export class MarginPoolQueries {
30
31
 
31
32
  async isDeepbookPoolAllowed(coinKey: string, deepbookPoolId: string): Promise<boolean> {
32
33
  const tx = new Transaction();
34
+ tx.setSender(this.#ctx.address);
33
35
  tx.add(this.#ctx.marginPool.deepbookPoolAllowed(coinKey, deepbookPoolId));
34
36
 
35
37
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -43,6 +45,7 @@ export class MarginPoolQueries {
43
45
 
44
46
  async getMarginPoolTotalSupply(coinKey: string, decimals: number = 6): Promise<string> {
45
47
  const tx = new Transaction();
48
+ tx.setSender(this.#ctx.address);
46
49
  tx.add(this.#ctx.marginPool.totalSupply(coinKey));
47
50
 
48
51
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -58,6 +61,7 @@ export class MarginPoolQueries {
58
61
 
59
62
  async getMarginPoolSupplyShares(coinKey: string, decimals: number = 6): Promise<string> {
60
63
  const tx = new Transaction();
64
+ tx.setSender(this.#ctx.address);
61
65
  tx.add(this.#ctx.marginPool.supplyShares(coinKey));
62
66
 
63
67
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -73,6 +77,7 @@ export class MarginPoolQueries {
73
77
 
74
78
  async getMarginPoolTotalBorrow(coinKey: string, decimals: number = 6): Promise<string> {
75
79
  const tx = new Transaction();
80
+ tx.setSender(this.#ctx.address);
76
81
  tx.add(this.#ctx.marginPool.totalBorrow(coinKey));
77
82
 
78
83
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -88,6 +93,7 @@ export class MarginPoolQueries {
88
93
 
89
94
  async getMarginPoolBorrowShares(coinKey: string, decimals: number = 6): Promise<string> {
90
95
  const tx = new Transaction();
96
+ tx.setSender(this.#ctx.address);
91
97
  tx.add(this.#ctx.marginPool.borrowShares(coinKey));
92
98
 
93
99
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -103,6 +109,7 @@ export class MarginPoolQueries {
103
109
 
104
110
  async getMarginPoolLastUpdateTimestamp(coinKey: string): Promise<number> {
105
111
  const tx = new Transaction();
112
+ tx.setSender(this.#ctx.address);
106
113
  tx.add(this.#ctx.marginPool.lastUpdateTimestamp(coinKey));
107
114
 
108
115
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -116,6 +123,7 @@ export class MarginPoolQueries {
116
123
 
117
124
  async getMarginPoolSupplyCap(coinKey: string, decimals: number = 6): Promise<string> {
118
125
  const tx = new Transaction();
126
+ tx.setSender(this.#ctx.address);
119
127
  tx.add(this.#ctx.marginPool.supplyCap(coinKey));
120
128
 
121
129
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -131,6 +139,7 @@ export class MarginPoolQueries {
131
139
 
132
140
  async getMarginPoolMaxUtilizationRate(coinKey: string): Promise<number> {
133
141
  const tx = new Transaction();
142
+ tx.setSender(this.#ctx.address);
134
143
  tx.add(this.#ctx.marginPool.maxUtilizationRate(coinKey));
135
144
 
136
145
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -145,6 +154,7 @@ export class MarginPoolQueries {
145
154
 
146
155
  async getMarginPoolProtocolSpread(coinKey: string): Promise<number> {
147
156
  const tx = new Transaction();
157
+ tx.setSender(this.#ctx.address);
148
158
  tx.add(this.#ctx.marginPool.protocolSpread(coinKey));
149
159
 
150
160
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -159,6 +169,7 @@ export class MarginPoolQueries {
159
169
 
160
170
  async getMarginPoolMinBorrow(coinKey: string, decimals: number = 6): Promise<string> {
161
171
  const tx = new Transaction();
172
+ tx.setSender(this.#ctx.address);
162
173
  tx.add(this.#ctx.marginPool.minBorrow(coinKey));
163
174
 
164
175
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -174,6 +185,7 @@ export class MarginPoolQueries {
174
185
 
175
186
  async getMarginPoolInterestRate(coinKey: string): Promise<number> {
176
187
  const tx = new Transaction();
188
+ tx.setSender(this.#ctx.address);
177
189
  tx.add(this.#ctx.marginPool.interestRate(coinKey));
178
190
 
179
191
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -192,6 +204,7 @@ export class MarginPoolQueries {
192
204
  decimals: number = 6,
193
205
  ): Promise<string> {
194
206
  const tx = new Transaction();
207
+ tx.setSender(this.#ctx.address);
195
208
  tx.add(this.#ctx.marginPool.userSupplyShares(coinKey, supplierCapId));
196
209
 
197
210
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -211,6 +224,7 @@ export class MarginPoolQueries {
211
224
  decimals: number = 6,
212
225
  ): Promise<string> {
213
226
  const tx = new Transaction();
227
+ tx.setSender(this.#ctx.address);
214
228
  tx.add(this.#ctx.marginPool.userSupplyAmount(coinKey, supplierCapId));
215
229
 
216
230
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -19,6 +19,7 @@ export class OrderQueries {
19
19
 
20
20
  async accountOpenOrders(poolKey: string, managerKey: string): Promise<string[]> {
21
21
  const tx = new Transaction();
22
+ tx.setSender(this.#ctx.address);
22
23
 
23
24
  tx.add(this.#ctx.deepBook.accountOpenOrders(poolKey, managerKey));
24
25
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -33,6 +34,7 @@ export class OrderQueries {
33
34
 
34
35
  async getOrder(poolKey: string, orderId: string): Promise<ReturnType<typeof Order.parse> | null> {
35
36
  const tx = new Transaction();
37
+ tx.setSender(this.#ctx.address);
36
38
 
37
39
  tx.add(this.#ctx.deepBook.getOrder(poolKey, orderId));
38
40
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -50,6 +52,7 @@ export class OrderQueries {
50
52
 
51
53
  async getOrderNormalized(poolKey: string, orderId: string) {
52
54
  const tx = new Transaction();
55
+ tx.setSender(this.#ctx.address);
53
56
  tx.add(this.#ctx.deepBook.getOrder(poolKey, orderId));
54
57
  const res = await this.#ctx.client.core.simulateTransaction({
55
58
  transaction: tx,
@@ -95,6 +98,7 @@ export class OrderQueries {
95
98
  orderIds: string[],
96
99
  ): Promise<ReturnType<typeof Order.parse>[] | null> {
97
100
  const tx = new Transaction();
101
+ tx.setSender(this.#ctx.address);
98
102
 
99
103
  tx.add(this.#ctx.deepBook.getOrders(poolKey, orderIds));
100
104
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -117,6 +121,7 @@ export class OrderQueries {
117
121
  isBid: boolean,
118
122
  ): Promise<Level2Range> {
119
123
  const tx = new Transaction();
124
+ tx.setSender(this.#ctx.address);
120
125
  const pool = this.#ctx.config.getPool(poolKey);
121
126
  const baseCoin = this.#ctx.config.getCoin(pool.baseCoin);
122
127
  const quoteCoin = this.#ctx.config.getCoin(pool.quoteCoin);
@@ -144,6 +149,7 @@ export class OrderQueries {
144
149
 
145
150
  async getLevel2TicksFromMid(poolKey: string, ticks: number): Promise<Level2TicksFromMid> {
146
151
  const tx = new Transaction();
152
+ tx.setSender(this.#ctx.address);
147
153
  const pool = this.#ctx.config.getPool(poolKey);
148
154
  const baseCoin = this.#ctx.config.getCoin(pool.baseCoin);
149
155
  const quoteCoin = this.#ctx.config.getCoin(pool.quoteCoin);
@@ -185,6 +191,7 @@ export class OrderQueries {
185
191
  managerKey: string,
186
192
  ): Promise<ReturnType<typeof Order.parse>[] | []> {
187
193
  const tx = new Transaction();
194
+ tx.setSender(this.#ctx.address);
188
195
  tx.add(this.#ctx.deepBook.getAccountOrderDetails(poolKey, managerKey));
189
196
 
190
197
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -24,6 +24,7 @@ export class PoolQueries {
24
24
 
25
25
  async whitelisted(poolKey: string): Promise<boolean> {
26
26
  const tx = new Transaction();
27
+ tx.setSender(this.#ctx.address);
27
28
 
28
29
  tx.add(this.#ctx.deepBook.whitelisted(poolKey));
29
30
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -37,6 +38,7 @@ export class PoolQueries {
37
38
 
38
39
  async vaultBalances(poolKey: string): Promise<VaultBalances> {
39
40
  const tx = new Transaction();
41
+ tx.setSender(this.#ctx.address);
40
42
  const pool = this.#ctx.config.getPool(poolKey);
41
43
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
42
44
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -60,6 +62,7 @@ export class PoolQueries {
60
62
 
61
63
  async getPoolIdByAssets(baseType: string, quoteType: string): Promise<string> {
62
64
  const tx = new Transaction();
65
+ tx.setSender(this.#ctx.address);
63
66
  tx.add(this.#ctx.deepBook.getPoolIdByAssets(baseType, quoteType));
64
67
 
65
68
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -72,6 +75,7 @@ export class PoolQueries {
72
75
 
73
76
  async midPrice(poolKey: string): Promise<number> {
74
77
  const tx = new Transaction();
78
+ tx.setSender(this.#ctx.address);
75
79
  const pool = this.#ctx.config.getPool(poolKey);
76
80
  tx.add(this.#ctx.deepBook.midPrice(poolKey));
77
81
 
@@ -93,6 +97,7 @@ export class PoolQueries {
93
97
 
94
98
  async poolTradeParams(poolKey: string): Promise<PoolTradeParams> {
95
99
  const tx = new Transaction();
100
+ tx.setSender(this.#ctx.address);
96
101
 
97
102
  tx.add(this.#ctx.deepBook.poolTradeParams(poolKey));
98
103
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -113,6 +118,7 @@ export class PoolQueries {
113
118
 
114
119
  async poolBookParams(poolKey: string): Promise<PoolBookParams> {
115
120
  const tx = new Transaction();
121
+ tx.setSender(this.#ctx.address);
116
122
  const pool = this.#ctx.config.getPool(poolKey);
117
123
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
118
124
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -136,6 +142,7 @@ export class PoolQueries {
136
142
 
137
143
  async stablePool(poolKey: string): Promise<boolean> {
138
144
  const tx = new Transaction();
145
+ tx.setSender(this.#ctx.address);
139
146
  tx.add(this.#ctx.deepBook.stablePool(poolKey));
140
147
 
141
148
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -149,6 +156,7 @@ export class PoolQueries {
149
156
 
150
157
  async registeredPool(poolKey: string): Promise<boolean> {
151
158
  const tx = new Transaction();
159
+ tx.setSender(this.#ctx.address);
152
160
  tx.add(this.#ctx.deepBook.registeredPool(poolKey));
153
161
 
154
162
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -162,6 +170,7 @@ export class PoolQueries {
162
170
 
163
171
  async poolTradeParamsNext(poolKey: string): Promise<PoolTradeParams> {
164
172
  const tx = new Transaction();
173
+ tx.setSender(this.#ctx.address);
165
174
  tx.add(this.#ctx.deepBook.poolTradeParamsNext(poolKey));
166
175
 
167
176
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -182,6 +191,7 @@ export class PoolQueries {
182
191
 
183
192
  async quorum(poolKey: string): Promise<number> {
184
193
  const tx = new Transaction();
194
+ tx.setSender(this.#ctx.address);
185
195
  tx.add(this.#ctx.deepBook.quorum(poolKey));
186
196
 
187
197
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -196,6 +206,7 @@ export class PoolQueries {
196
206
 
197
207
  async poolId(poolKey: string): Promise<string> {
198
208
  const tx = new Transaction();
209
+ tx.setSender(this.#ctx.address);
199
210
  tx.add(this.#ctx.deepBook.poolId(poolKey));
200
211
 
201
212
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -209,6 +220,7 @@ export class PoolQueries {
209
220
 
210
221
  async canPlaceLimitOrder(params: CanPlaceLimitOrderParams): Promise<boolean> {
211
222
  const tx = new Transaction();
223
+ tx.setSender(this.#ctx.address);
212
224
  tx.add(this.#ctx.deepBook.canPlaceLimitOrder(params));
213
225
 
214
226
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -222,6 +234,7 @@ export class PoolQueries {
222
234
 
223
235
  async canPlaceMarketOrder(params: CanPlaceMarketOrderParams): Promise<boolean> {
224
236
  const tx = new Transaction();
237
+ tx.setSender(this.#ctx.address);
225
238
  tx.add(this.#ctx.deepBook.canPlaceMarketOrder(params));
226
239
 
227
240
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -235,6 +248,7 @@ export class PoolQueries {
235
248
 
236
249
  async checkMarketOrderParams(poolKey: string, quantity: number | bigint): Promise<boolean> {
237
250
  const tx = new Transaction();
251
+ tx.setSender(this.#ctx.address);
238
252
  tx.add(this.#ctx.deepBook.checkMarketOrderParams(poolKey, quantity));
239
253
 
240
254
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -253,6 +267,7 @@ export class PoolQueries {
253
267
  expireTimestamp: number,
254
268
  ): Promise<boolean> {
255
269
  const tx = new Transaction();
270
+ tx.setSender(this.#ctx.address);
256
271
  tx.add(this.#ctx.deepBook.checkLimitOrderParams(poolKey, price, quantity, expireTimestamp));
257
272
 
258
273
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -27,6 +27,7 @@ export class QuantityQueries {
27
27
  baseQuantity: number | bigint,
28
28
  ): Promise<QuoteQuantityOut> {
29
29
  const tx = new Transaction();
30
+ tx.setSender(this.#ctx.address);
30
31
  const pool = this.#ctx.config.getPool(poolKey);
31
32
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
32
33
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -54,6 +55,7 @@ export class QuantityQueries {
54
55
  quoteQuantity: number | bigint,
55
56
  ): Promise<BaseQuantityOut> {
56
57
  const tx = new Transaction();
58
+ tx.setSender(this.#ctx.address);
57
59
  const pool = this.#ctx.config.getPool(poolKey);
58
60
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
59
61
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -82,6 +84,7 @@ export class QuantityQueries {
82
84
  quoteQuantity: number | bigint,
83
85
  ): Promise<QuantityOut> {
84
86
  const tx = new Transaction();
87
+ tx.setSender(this.#ctx.address);
85
88
  const pool = this.#ctx.config.getPool(poolKey);
86
89
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
87
90
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -110,6 +113,7 @@ export class QuantityQueries {
110
113
  baseQuantity: number | bigint,
111
114
  ): Promise<QuoteQuantityOut> {
112
115
  const tx = new Transaction();
116
+ tx.setSender(this.#ctx.address);
113
117
  const pool = this.#ctx.config.getPool(poolKey);
114
118
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
115
119
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -137,6 +141,7 @@ export class QuantityQueries {
137
141
  quoteQuantity: number | bigint,
138
142
  ): Promise<BaseQuantityOut> {
139
143
  const tx = new Transaction();
144
+ tx.setSender(this.#ctx.address);
140
145
  const pool = this.#ctx.config.getPool(poolKey);
141
146
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
142
147
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -165,6 +170,7 @@ export class QuantityQueries {
165
170
  quoteQuantity: number | bigint,
166
171
  ): Promise<QuantityOut> {
167
172
  const tx = new Transaction();
173
+ tx.setSender(this.#ctx.address);
168
174
  const pool = this.#ctx.config.getPool(poolKey);
169
175
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
170
176
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -194,6 +200,7 @@ export class QuantityQueries {
194
200
  payWithDeep: boolean,
195
201
  ): Promise<BaseQuantityIn> {
196
202
  const tx = new Transaction();
203
+ tx.setSender(this.#ctx.address);
197
204
  const pool = this.#ctx.config.getPool(poolKey);
198
205
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
199
206
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -221,6 +228,7 @@ export class QuantityQueries {
221
228
  payWithDeep: boolean,
222
229
  ): Promise<QuoteQuantityIn> {
223
230
  const tx = new Transaction();
231
+ tx.setSender(this.#ctx.address);
224
232
  const pool = this.#ctx.config.getPool(poolKey);
225
233
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
226
234
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -248,6 +256,7 @@ export class QuantityQueries {
248
256
  price: number | bigint,
249
257
  ): Promise<OrderDeepRequiredResult> {
250
258
  const tx = new Transaction();
259
+ tx.setSender(this.#ctx.address);
251
260
  tx.add(this.#ctx.deepBook.getOrderDeepRequired(poolKey, baseQuantity, price));
252
261
 
253
262
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -18,6 +18,7 @@ export class ReferralQueries {
18
18
 
19
19
  async balanceManagerReferralOwner(referral: string): Promise<string> {
20
20
  const tx = new Transaction();
21
+ tx.setSender(this.#ctx.address);
21
22
  tx.add(this.#ctx.balanceManager.balanceManagerReferralOwner(referral));
22
23
 
23
24
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -31,6 +32,7 @@ export class ReferralQueries {
31
32
 
32
33
  async getPoolReferralBalances(poolKey: string, referral: string): Promise<ReferralBalances> {
33
34
  const tx = new Transaction();
35
+ tx.setSender(this.#ctx.address);
34
36
  const pool = this.#ctx.config.getPool(poolKey);
35
37
  const baseScalar = this.#ctx.config.getCoin(pool.baseCoin).scalar;
36
38
  const quoteScalar = this.#ctx.config.getCoin(pool.quoteCoin).scalar;
@@ -59,6 +61,7 @@ export class ReferralQueries {
59
61
 
60
62
  async balanceManagerReferralPoolId(referral: string): Promise<string> {
61
63
  const tx = new Transaction();
64
+ tx.setSender(this.#ctx.address);
62
65
 
63
66
  tx.add(this.#ctx.balanceManager.balanceManagerReferralPoolId(referral));
64
67
 
@@ -75,6 +78,7 @@ export class ReferralQueries {
75
78
 
76
79
  async poolReferralMultiplier(poolKey: string, referral: string): Promise<number> {
77
80
  const tx = new Transaction();
81
+ tx.setSender(this.#ctx.address);
78
82
 
79
83
  tx.add(this.#ctx.deepBook.poolReferralMultiplier(poolKey, referral));
80
84
 
@@ -91,6 +95,7 @@ export class ReferralQueries {
91
95
 
92
96
  async getBalanceManagerReferralId(managerKey: string, poolKey: string): Promise<string | null> {
93
97
  const tx = new Transaction();
98
+ tx.setSender(this.#ctx.address);
94
99
  tx.add(this.#ctx.balanceManager.getBalanceManagerReferralId(managerKey, poolKey));
95
100
 
96
101
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -18,6 +18,7 @@ export class RegistryQueries {
18
18
 
19
19
  async isPoolEnabledForMargin(poolKey: string): Promise<boolean> {
20
20
  const tx = new Transaction();
21
+ tx.setSender(this.#ctx.address);
21
22
  tx.add(this.#ctx.marginRegistry.poolEnabled(poolKey));
22
23
 
23
24
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -31,6 +32,7 @@ export class RegistryQueries {
31
32
 
32
33
  async getMarginManagerIdsForOwner(owner: string): Promise<string[]> {
33
34
  const tx = new Transaction();
35
+ tx.setSender(this.#ctx.address);
34
36
  tx.add(this.#ctx.marginRegistry.getMarginManagerIds(owner));
35
37
 
36
38
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -45,6 +47,7 @@ export class RegistryQueries {
45
47
 
46
48
  async getBaseMarginPoolId(poolKey: string): Promise<string> {
47
49
  const tx = new Transaction();
50
+ tx.setSender(this.#ctx.address);
48
51
  tx.add(this.#ctx.marginRegistry.baseMarginPoolId(poolKey));
49
52
 
50
53
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -59,6 +62,7 @@ export class RegistryQueries {
59
62
 
60
63
  async getQuoteMarginPoolId(poolKey: string): Promise<string> {
61
64
  const tx = new Transaction();
65
+ tx.setSender(this.#ctx.address);
62
66
  tx.add(this.#ctx.marginRegistry.quoteMarginPoolId(poolKey));
63
67
 
64
68
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -73,6 +77,7 @@ export class RegistryQueries {
73
77
 
74
78
  async getMinWithdrawRiskRatio(poolKey: string): Promise<number> {
75
79
  const tx = new Transaction();
80
+ tx.setSender(this.#ctx.address);
76
81
  tx.add(this.#ctx.marginRegistry.minWithdrawRiskRatio(poolKey));
77
82
 
78
83
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -87,6 +92,7 @@ export class RegistryQueries {
87
92
 
88
93
  async getMinBorrowRiskRatio(poolKey: string): Promise<number> {
89
94
  const tx = new Transaction();
95
+ tx.setSender(this.#ctx.address);
90
96
  tx.add(this.#ctx.marginRegistry.minBorrowRiskRatio(poolKey));
91
97
 
92
98
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -101,6 +107,7 @@ export class RegistryQueries {
101
107
 
102
108
  async getLiquidationRiskRatio(poolKey: string): Promise<number> {
103
109
  const tx = new Transaction();
110
+ tx.setSender(this.#ctx.address);
104
111
  tx.add(this.#ctx.marginRegistry.liquidationRiskRatio(poolKey));
105
112
 
106
113
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -115,6 +122,7 @@ export class RegistryQueries {
115
122
 
116
123
  async getTargetLiquidationRiskRatio(poolKey: string): Promise<number> {
117
124
  const tx = new Transaction();
125
+ tx.setSender(this.#ctx.address);
118
126
  tx.add(this.#ctx.marginRegistry.targetLiquidationRiskRatio(poolKey));
119
127
 
120
128
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -129,6 +137,7 @@ export class RegistryQueries {
129
137
 
130
138
  async getUserLiquidationReward(poolKey: string): Promise<number> {
131
139
  const tx = new Transaction();
140
+ tx.setSender(this.#ctx.address);
132
141
  tx.add(this.#ctx.marginRegistry.userLiquidationReward(poolKey));
133
142
 
134
143
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -143,6 +152,7 @@ export class RegistryQueries {
143
152
 
144
153
  async getPoolLiquidationReward(poolKey: string): Promise<number> {
145
154
  const tx = new Transaction();
155
+ tx.setSender(this.#ctx.address);
146
156
  tx.add(this.#ctx.marginRegistry.poolLiquidationReward(poolKey));
147
157
 
148
158
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -157,6 +167,7 @@ export class RegistryQueries {
157
167
 
158
168
  async getAllowedMaintainers(): Promise<string[]> {
159
169
  const tx = new Transaction();
170
+ tx.setSender(this.#ctx.address);
160
171
  tx.add(this.#ctx.marginRegistry.allowedMaintainers());
161
172
 
162
173
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -171,6 +182,7 @@ export class RegistryQueries {
171
182
 
172
183
  async getAllowedPauseCaps(): Promise<string[]> {
173
184
  const tx = new Transaction();
185
+ tx.setSender(this.#ctx.address);
174
186
  tx.add(this.#ctx.marginRegistry.allowedPauseCaps());
175
187
 
176
188
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -16,6 +16,7 @@ export class TPSLQueries {
16
16
  async getConditionalOrderIds(marginManagerKey: string): Promise<string[]> {
17
17
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
18
18
  const tx = new Transaction();
19
+ tx.setSender(this.#ctx.address);
19
20
  tx.add(this.#ctx.marginTPSL.conditionalOrderIds(manager.poolKey, manager.address));
20
21
 
21
22
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -41,6 +42,7 @@ export class TPSLQueries {
41
42
  async getLowestTriggerAbovePrice(marginManagerKey: string): Promise<bigint> {
42
43
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
43
44
  const tx = new Transaction();
45
+ tx.setSender(this.#ctx.address);
44
46
  tx.add(this.#ctx.marginTPSL.lowestTriggerAbovePrice(manager.poolKey, manager.address));
45
47
 
46
48
  const res = await this.#ctx.client.core.simulateTransaction({
@@ -65,6 +67,7 @@ export class TPSLQueries {
65
67
  async getHighestTriggerBelowPrice(marginManagerKey: string): Promise<bigint> {
66
68
  const manager = this.#ctx.config.getMarginManager(marginManagerKey);
67
69
  const tx = new Transaction();
70
+ tx.setSender(this.#ctx.address);
68
71
  tx.add(this.#ctx.marginTPSL.highestTriggerBelowPrice(manager.poolKey, manager.address));
69
72
 
70
73
  const res = await this.#ctx.client.core.simulateTransaction({