@mysten/deepbook-v3 0.20.2 → 0.20.4

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 (32) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/client.d.ts +51 -30
  3. package/dist/cjs/client.js +110 -43
  4. package/dist/cjs/client.js.map +2 -2
  5. package/dist/cjs/transactions/marginAdmin.d.ts +7 -0
  6. package/dist/cjs/transactions/marginAdmin.js +23 -1
  7. package/dist/cjs/transactions/marginAdmin.js.map +2 -2
  8. package/dist/cjs/transactions/marginManager.d.ts +10 -0
  9. package/dist/cjs/transactions/marginManager.js +30 -0
  10. package/dist/cjs/transactions/marginManager.js.map +2 -2
  11. package/dist/cjs/transactions/marginPool.d.ts +1 -1
  12. package/dist/cjs/transactions/marginPool.js +6 -2
  13. package/dist/cjs/transactions/marginPool.js.map +2 -2
  14. package/dist/esm/client.d.ts +51 -30
  15. package/dist/esm/client.js +110 -43
  16. package/dist/esm/client.js.map +2 -2
  17. package/dist/esm/transactions/marginAdmin.d.ts +7 -0
  18. package/dist/esm/transactions/marginAdmin.js +23 -1
  19. package/dist/esm/transactions/marginAdmin.js.map +2 -2
  20. package/dist/esm/transactions/marginManager.d.ts +10 -0
  21. package/dist/esm/transactions/marginManager.js +30 -0
  22. package/dist/esm/transactions/marginManager.js.map +2 -2
  23. package/dist/esm/transactions/marginPool.d.ts +1 -1
  24. package/dist/esm/transactions/marginPool.js +6 -2
  25. package/dist/esm/transactions/marginPool.js.map +2 -2
  26. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +3 -3
  29. package/src/client.ts +151 -59
  30. package/src/transactions/marginAdmin.ts +23 -0
  31. package/src/transactions/marginManager.ts +31 -0
  32. package/src/transactions/marginPool.ts +6 -2
package/src/client.ts CHANGED
@@ -1136,13 +1136,13 @@ export class DeepBookClient {
1136
1136
 
1137
1137
  /**
1138
1138
  * @description Get the owner address of a margin manager
1139
- * @param {string} poolKey The key to identify the pool
1140
- * @param {string} marginManagerId The ID of the margin manager
1139
+ * @param {string} marginManagerKey The key to identify the margin manager
1141
1140
  * @returns {Promise<string>} The owner address
1142
1141
  */
1143
- async getMarginManagerOwner(poolKey: string, marginManagerId: string): Promise<string> {
1142
+ async getMarginManagerOwner(marginManagerKey: string): Promise<string> {
1143
+ const manager = this.#config.getMarginManager(marginManagerKey);
1144
1144
  const tx = new Transaction();
1145
- tx.add(this.marginManager.ownerByPoolKey(poolKey, marginManagerId));
1145
+ tx.add(this.marginManager.ownerByPoolKey(manager.poolKey, manager.address));
1146
1146
 
1147
1147
  const res = await this.client.devInspectTransactionBlock({
1148
1148
  sender: normalizeSuiAddress(this.#address),
@@ -1155,13 +1155,13 @@ export class DeepBookClient {
1155
1155
 
1156
1156
  /**
1157
1157
  * @description Get the DeepBook pool ID associated with a margin manager
1158
- * @param {string} poolKey The key to identify the pool
1159
- * @param {string} marginManagerId The ID of the margin manager
1158
+ * @param {string} marginManagerKey The key to identify the margin manager
1160
1159
  * @returns {Promise<string>} The DeepBook pool ID
1161
1160
  */
1162
- async getMarginManagerDeepbookPool(poolKey: string, marginManagerId: string): Promise<string> {
1161
+ async getMarginManagerDeepbookPool(marginManagerKey: string): Promise<string> {
1162
+ const manager = this.#config.getMarginManager(marginManagerKey);
1163
1163
  const tx = new Transaction();
1164
- tx.add(this.marginManager.deepbookPool(poolKey, marginManagerId));
1164
+ tx.add(this.marginManager.deepbookPool(manager.poolKey, manager.address));
1165
1165
 
1166
1166
  const res = await this.client.devInspectTransactionBlock({
1167
1167
  sender: normalizeSuiAddress(this.#address),
@@ -1174,16 +1174,13 @@ export class DeepBookClient {
1174
1174
 
1175
1175
  /**
1176
1176
  * @description Get the margin pool ID (if any) associated with a margin manager
1177
- * @param {string} poolKey The key to identify the pool
1178
- * @param {string} marginManagerId The ID of the margin manager
1177
+ * @param {string} marginManagerKey The key to identify the margin manager
1179
1178
  * @returns {Promise<string | null>} The margin pool ID or null if no active loan
1180
1179
  */
1181
- async getMarginManagerMarginPoolId(
1182
- poolKey: string,
1183
- marginManagerId: string,
1184
- ): Promise<string | null> {
1180
+ async getMarginManagerMarginPoolId(marginManagerKey: string): Promise<string | null> {
1181
+ const manager = this.#config.getMarginManager(marginManagerKey);
1185
1182
  const tx = new Transaction();
1186
- tx.add(this.marginManager.marginPoolId(poolKey, marginManagerId));
1183
+ tx.add(this.marginManager.marginPoolId(manager.poolKey, manager.address));
1187
1184
 
1188
1185
  const res = await this.client.devInspectTransactionBlock({
1189
1186
  sender: normalizeSuiAddress(this.#address),
@@ -1197,16 +1194,15 @@ export class DeepBookClient {
1197
1194
 
1198
1195
  /**
1199
1196
  * @description Get borrowed shares for both base and quote assets
1200
- * @param {string} poolKey The key to identify the pool
1201
- * @param {string} marginManagerId The ID of the margin manager
1197
+ * @param {string} marginManagerKey The key to identify the margin manager
1202
1198
  * @returns {Promise<{baseShares: string, quoteShares: string}>} The borrowed shares
1203
1199
  */
1204
1200
  async getMarginManagerBorrowedShares(
1205
- poolKey: string,
1206
- marginManagerId: string,
1201
+ marginManagerKey: string,
1207
1202
  ): Promise<{ baseShares: string; quoteShares: string }> {
1203
+ const manager = this.#config.getMarginManager(marginManagerKey);
1208
1204
  const tx = new Transaction();
1209
- tx.add(this.marginManager.borrowedShares(poolKey, marginManagerId));
1205
+ tx.add(this.marginManager.borrowedShares(manager.poolKey, manager.address));
1210
1206
 
1211
1207
  const res = await this.client.devInspectTransactionBlock({
1212
1208
  sender: normalizeSuiAddress(this.#address),
@@ -1223,16 +1219,13 @@ export class DeepBookClient {
1223
1219
 
1224
1220
  /**
1225
1221
  * @description Get borrowed base shares
1226
- * @param {string} poolKey The key to identify the pool
1227
- * @param {string} marginManagerId The ID of the margin manager
1222
+ * @param {string} marginManagerKey The key to identify the margin manager
1228
1223
  * @returns {Promise<string>} The borrowed base shares
1229
1224
  */
1230
- async getMarginManagerBorrowedBaseShares(
1231
- poolKey: string,
1232
- marginManagerId: string,
1233
- ): Promise<string> {
1225
+ async getMarginManagerBorrowedBaseShares(marginManagerKey: string): Promise<string> {
1226
+ const manager = this.#config.getMarginManager(marginManagerKey);
1234
1227
  const tx = new Transaction();
1235
- tx.add(this.marginManager.borrowedBaseShares(poolKey, marginManagerId));
1228
+ tx.add(this.marginManager.borrowedBaseShares(manager.poolKey, manager.address));
1236
1229
 
1237
1230
  const res = await this.client.devInspectTransactionBlock({
1238
1231
  sender: normalizeSuiAddress(this.#address),
@@ -1245,16 +1238,13 @@ export class DeepBookClient {
1245
1238
 
1246
1239
  /**
1247
1240
  * @description Get borrowed quote shares
1248
- * @param {string} poolKey The key to identify the pool
1249
- * @param {string} marginManagerId The ID of the margin manager
1241
+ * @param {string} marginManagerKey The key to identify the margin manager
1250
1242
  * @returns {Promise<string>} The borrowed quote shares
1251
1243
  */
1252
- async getMarginManagerBorrowedQuoteShares(
1253
- poolKey: string,
1254
- marginManagerId: string,
1255
- ): Promise<string> {
1244
+ async getMarginManagerBorrowedQuoteShares(marginManagerKey: string): Promise<string> {
1245
+ const manager = this.#config.getMarginManager(marginManagerKey);
1256
1246
  const tx = new Transaction();
1257
- tx.add(this.marginManager.borrowedQuoteShares(poolKey, marginManagerId));
1247
+ tx.add(this.marginManager.borrowedQuoteShares(manager.poolKey, manager.address));
1258
1248
 
1259
1249
  const res = await this.client.devInspectTransactionBlock({
1260
1250
  sender: normalizeSuiAddress(this.#address),
@@ -1267,13 +1257,13 @@ export class DeepBookClient {
1267
1257
 
1268
1258
  /**
1269
1259
  * @description Check if margin manager has base asset debt
1270
- * @param {string} poolKey The key to identify the pool
1271
- * @param {string} marginManagerId The ID of the margin manager
1260
+ * @param {string} marginManagerKey The key to identify the margin manager
1272
1261
  * @returns {Promise<boolean>} True if has base debt, false otherwise
1273
1262
  */
1274
- async getMarginManagerHasBaseDebt(poolKey: string, marginManagerId: string): Promise<boolean> {
1263
+ async getMarginManagerHasBaseDebt(marginManagerKey: string): Promise<boolean> {
1264
+ const manager = this.#config.getMarginManager(marginManagerKey);
1275
1265
  const tx = new Transaction();
1276
- tx.add(this.marginManager.hasBaseDebt(poolKey, marginManagerId));
1266
+ tx.add(this.marginManager.hasBaseDebt(manager.poolKey, manager.address));
1277
1267
 
1278
1268
  const res = await this.client.devInspectTransactionBlock({
1279
1269
  sender: normalizeSuiAddress(this.#address),
@@ -1286,16 +1276,13 @@ export class DeepBookClient {
1286
1276
 
1287
1277
  /**
1288
1278
  * @description Get the balance manager ID for a margin manager
1289
- * @param {string} poolKey The key to identify the pool
1290
- * @param {string} marginManagerId The ID of the margin manager
1279
+ * @param {string} marginManagerKey The key to identify the margin manager
1291
1280
  * @returns {Promise<string>} The balance manager ID
1292
1281
  */
1293
- async getMarginManagerBalanceManagerId(
1294
- poolKey: string,
1295
- marginManagerId: string,
1296
- ): Promise<string> {
1282
+ async getMarginManagerBalanceManagerId(marginManagerKey: string): Promise<string> {
1283
+ const manager = this.#config.getMarginManager(marginManagerKey);
1297
1284
  const tx = new Transaction();
1298
- tx.add(this.marginManager.balanceManager(poolKey, marginManagerId));
1285
+ tx.add(this.marginManager.balanceManager(manager.poolKey, manager.address));
1299
1286
 
1300
1287
  const res = await this.client.devInspectTransactionBlock({
1301
1288
  sender: normalizeSuiAddress(this.#address),
@@ -1308,18 +1295,17 @@ export class DeepBookClient {
1308
1295
 
1309
1296
  /**
1310
1297
  * @description Calculate assets (base and quote) for a margin manager
1311
- * @param {string} poolKey The key to identify the pool
1312
- * @param {string} marginManagerId The ID of the margin manager
1298
+ * @param {string} marginManagerKey The key to identify the margin manager
1313
1299
  * @param {number} decimals Number of decimal places to show (default: 6)
1314
1300
  * @returns {Promise<{baseAsset: string, quoteAsset: string}>} The base and quote assets
1315
1301
  */
1316
1302
  async getMarginManagerAssets(
1317
- poolKey: string,
1318
- marginManagerId: string,
1303
+ marginManagerKey: string,
1319
1304
  decimals: number = 6,
1320
1305
  ): Promise<{ baseAsset: string; quoteAsset: string }> {
1306
+ const manager = this.#config.getMarginManager(marginManagerKey);
1321
1307
  const tx = new Transaction();
1322
- tx.add(this.marginManager.calculateAssets(poolKey, marginManagerId));
1308
+ tx.add(this.marginManager.calculateAssets(manager.poolKey, manager.address));
1323
1309
 
1324
1310
  const res = await this.client.devInspectTransactionBlock({
1325
1311
  sender: normalizeSuiAddress(this.#address),
@@ -1328,7 +1314,7 @@ export class DeepBookClient {
1328
1314
 
1329
1315
  const baseBytes = res.results![0].returnValues![0][0];
1330
1316
  const quoteBytes = res.results![0].returnValues![1][0];
1331
- const pool = this.#config.getPool(poolKey);
1317
+ const pool = this.#config.getPool(manager.poolKey);
1332
1318
  const baseCoin = this.#config.getCoin(pool.baseCoin);
1333
1319
  const quoteCoin = this.#config.getCoin(pool.quoteCoin);
1334
1320
 
@@ -1350,26 +1336,25 @@ export class DeepBookClient {
1350
1336
  * @description Calculate debts (base and quote) for a margin manager
1351
1337
  * NOTE: This function automatically determines whether to use base or quote margin pool
1352
1338
  * based on hasBaseDebt. You don't need to specify the debt coin type.
1353
- * @param {string} poolKey The key to identify the pool
1354
- * @param {string} marginManagerId The ID of the margin manager
1339
+ * @param {string} marginManagerKey The key to identify the margin manager
1355
1340
  * @param {number} decimals Number of decimal places to show (default: 6)
1356
1341
  * @returns {Promise<{baseDebt: string, quoteDebt: string}>} The base and quote debts
1357
1342
  */
1358
1343
  async getMarginManagerDebts(
1359
- poolKey: string,
1360
- marginManagerId: string,
1344
+ marginManagerKey: string,
1361
1345
  decimals: number = 6,
1362
1346
  ): Promise<{ baseDebt: string; quoteDebt: string }> {
1363
1347
  // First check if the margin manager has base debt
1364
- const hasBaseDebt = await this.getMarginManagerHasBaseDebt(poolKey, marginManagerId);
1348
+ const hasBaseDebt = await this.getMarginManagerHasBaseDebt(marginManagerKey);
1365
1349
 
1366
- // Get the pool configuration to determine base and quote coins
1367
- const pool = this.#config.getPool(poolKey);
1350
+ // Get the manager and pool configuration
1351
+ const manager = this.#config.getMarginManager(marginManagerKey);
1352
+ const pool = this.#config.getPool(manager.poolKey);
1368
1353
  const debtCoinKey = hasBaseDebt ? pool.baseCoin : pool.quoteCoin;
1369
1354
 
1370
1355
  // Now call calculateDebts with the correct debt coin
1371
1356
  const tx = new Transaction();
1372
- tx.add(this.marginManager.calculateDebts(poolKey, debtCoinKey, marginManagerId));
1357
+ tx.add(this.marginManager.calculateDebts(manager.poolKey, debtCoinKey, manager.address));
1373
1358
 
1374
1359
  const res = await this.client.devInspectTransactionBlock({
1375
1360
  sender: normalizeSuiAddress(this.#address),
@@ -1402,6 +1387,113 @@ export class DeepBookClient {
1402
1387
  return { baseDebt, quoteDebt };
1403
1388
  }
1404
1389
 
1390
+ /**
1391
+ * @description Get comprehensive state information for a margin manager
1392
+ * @param {string} marginManagerKey The key to identify the margin manager
1393
+ * @param {number} decimals Number of decimal places to show (default: 6)
1394
+ * @returns {Promise<{
1395
+ * managerId: string,
1396
+ * deepbookPoolId: string,
1397
+ * riskRatio: number,
1398
+ * baseAsset: string,
1399
+ * quoteAsset: string,
1400
+ * baseDebt: string,
1401
+ * quoteDebt: string,
1402
+ * basePythPrice: string,
1403
+ * basePythDecimals: number,
1404
+ * quotePythPrice: string,
1405
+ * quotePythDecimals: number
1406
+ * }>} Comprehensive margin manager state
1407
+ */
1408
+ async getMarginManagerState(
1409
+ marginManagerKey: string,
1410
+ decimals: number = 6,
1411
+ ): Promise<{
1412
+ managerId: string;
1413
+ deepbookPoolId: string;
1414
+ riskRatio: number;
1415
+ baseAsset: string;
1416
+ quoteAsset: string;
1417
+ baseDebt: string;
1418
+ quoteDebt: string;
1419
+ basePythPrice: string;
1420
+ basePythDecimals: number;
1421
+ quotePythPrice: string;
1422
+ quotePythDecimals: number;
1423
+ }> {
1424
+ const manager = this.#config.getMarginManager(marginManagerKey);
1425
+ const tx = new Transaction();
1426
+ tx.add(this.marginManager.managerState(manager.poolKey, manager.address));
1427
+
1428
+ const res = await this.client.devInspectTransactionBlock({
1429
+ sender: normalizeSuiAddress(this.#address),
1430
+ transactionBlock: tx,
1431
+ });
1432
+
1433
+ // Check if the transaction failed
1434
+ if (!res.results || !res.results[0] || !res.results[0].returnValues) {
1435
+ throw new Error(
1436
+ `Failed to get margin manager state: ${res.effects?.status?.error || 'Unknown error'}`,
1437
+ );
1438
+ }
1439
+
1440
+ const pool = this.#config.getPool(manager.poolKey);
1441
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
1442
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
1443
+
1444
+ // Parse all 11 return values
1445
+ const managerId = normalizeSuiAddress(
1446
+ bcs.Address.parse(new Uint8Array(res.results[0].returnValues[0][0])),
1447
+ );
1448
+ const deepbookPoolId = normalizeSuiAddress(
1449
+ bcs.Address.parse(new Uint8Array(res.results[0].returnValues[1][0])),
1450
+ );
1451
+ const riskRatio =
1452
+ Number(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[2][0]))) / FLOAT_SCALAR;
1453
+ const baseAsset = this.#formatTokenAmount(
1454
+ BigInt(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[3][0]))),
1455
+ baseCoin.scalar,
1456
+ decimals,
1457
+ );
1458
+ const quoteAsset = this.#formatTokenAmount(
1459
+ BigInt(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[4][0]))),
1460
+ quoteCoin.scalar,
1461
+ decimals,
1462
+ );
1463
+ const baseDebt = this.#formatTokenAmount(
1464
+ BigInt(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[5][0]))),
1465
+ baseCoin.scalar,
1466
+ decimals,
1467
+ );
1468
+ const quoteDebt = this.#formatTokenAmount(
1469
+ BigInt(bcs.U64.parse(new Uint8Array(res.results[0].returnValues[6][0]))),
1470
+ quoteCoin.scalar,
1471
+ decimals,
1472
+ );
1473
+ const basePythPrice = bcs.U64.parse(new Uint8Array(res.results[0].returnValues[7][0]));
1474
+ const basePythDecimals = Number(
1475
+ bcs.u8().parse(new Uint8Array(res.results[0].returnValues[8][0])),
1476
+ );
1477
+ const quotePythPrice = bcs.U64.parse(new Uint8Array(res.results[0].returnValues[9][0]));
1478
+ const quotePythDecimals = Number(
1479
+ bcs.u8().parse(new Uint8Array(res.results[0].returnValues[10][0])),
1480
+ );
1481
+
1482
+ return {
1483
+ managerId,
1484
+ deepbookPoolId,
1485
+ riskRatio,
1486
+ baseAsset,
1487
+ quoteAsset,
1488
+ baseDebt,
1489
+ quoteDebt,
1490
+ basePythPrice: basePythPrice.toString(),
1491
+ basePythDecimals,
1492
+ quotePythPrice: quotePythPrice.toString(),
1493
+ quotePythDecimals,
1494
+ };
1495
+ }
1496
+
1405
1497
  // === Margin Registry Functions ===
1406
1498
 
1407
1499
  /**
@@ -139,6 +139,8 @@ export class MarginAdminContract {
139
139
  */
140
140
  updateRiskParams = (poolKey: string, poolConfig: TransactionArgument) => (tx: Transaction) => {
141
141
  const pool = this.#config.getPool(poolKey);
142
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
143
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
142
144
  tx.moveCall({
143
145
  target: `${this.#config.MARGIN_PACKAGE_ID}::margin_registry::update_risk_params`,
144
146
  arguments: [
@@ -148,6 +150,7 @@ export class MarginAdminContract {
148
150
  poolConfig,
149
151
  tx.object.clock(),
150
152
  ],
153
+ typeArguments: [baseCoin.type, quoteCoin.type],
151
154
  });
152
155
  };
153
156
 
@@ -358,4 +361,24 @@ export class MarginAdminContract {
358
361
  ],
359
362
  });
360
363
  };
364
+
365
+ /**
366
+ * @description Withdraw the default referral fees (admin only)
367
+ * The default referral at 0x0 doesn't have a SupplyReferral object
368
+ * @param {string} coinKey The key to identify the margin pool
369
+ * @returns A function that takes a Transaction object and returns a Coin<Asset>
370
+ */
371
+ adminWithdrawDefaultReferralFees = (coinKey: string) => (tx: Transaction) => {
372
+ const coin = this.#config.getCoin(coinKey);
373
+ const marginPool = this.#config.getMarginPool(coinKey);
374
+ return tx.moveCall({
375
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::admin_withdraw_default_referral_fees`,
376
+ arguments: [
377
+ tx.object(marginPool.address),
378
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
379
+ tx.object(this.#marginAdminCap()),
380
+ ],
381
+ typeArguments: [coin.type],
382
+ });
383
+ };
361
384
  }
@@ -562,4 +562,35 @@ export class MarginManagerContract {
562
562
  typeArguments: [baseCoin.type, quoteCoin.type, debtCoin.type],
563
563
  });
564
564
  };
565
+
566
+ /**
567
+ * @description Get comprehensive state information for a margin manager
568
+ * @param {string} poolKey The key to identify the pool
569
+ * @param {string} marginManagerId The ID of the margin manager
570
+ * @returns A function that takes a Transaction object
571
+ * @returns Returns (manager_id, deepbook_pool_id, risk_ratio, base_asset, quote_asset,
572
+ * base_debt, quote_debt, base_pyth_price, base_pyth_decimals,
573
+ * quote_pyth_price, quote_pyth_decimals)
574
+ */
575
+ managerState = (poolKey: string, marginManagerId: string) => (tx: Transaction) => {
576
+ const pool = this.#config.getPool(poolKey);
577
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
578
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
579
+ const baseMarginPool = this.#config.getMarginPool(pool.baseCoin);
580
+ const quoteMarginPool = this.#config.getMarginPool(pool.quoteCoin);
581
+ return tx.moveCall({
582
+ target: `${this.#config.MARGIN_PACKAGE_ID}::margin_manager::manager_state`,
583
+ arguments: [
584
+ tx.object(marginManagerId),
585
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
586
+ tx.object(baseCoin.priceInfoObjectId!),
587
+ tx.object(quoteCoin.priceInfoObjectId!),
588
+ tx.object(pool.address),
589
+ tx.object(baseMarginPool.address),
590
+ tx.object(quoteMarginPool.address),
591
+ tx.object.clock(),
592
+ ],
593
+ typeArguments: [baseCoin.type, quoteCoin.type],
594
+ });
595
+ };
565
596
  }
@@ -125,9 +125,13 @@ export class MarginPoolContract {
125
125
  */
126
126
  withdrawReferralFees = (coinKey: string, referralId: string) => (tx: Transaction) => {
127
127
  const marginPool = this.#config.getMarginPool(coinKey);
128
- tx.moveCall({
128
+ return tx.moveCall({
129
129
  target: `${this.#config.MARGIN_PACKAGE_ID}::margin_pool::withdraw_referral_fees`,
130
- arguments: [tx.object(marginPool.address), tx.object(referralId), tx.object.clock()],
130
+ arguments: [
131
+ tx.object(marginPool.address),
132
+ tx.object(this.#config.MARGIN_REGISTRY_ID),
133
+ tx.object(referralId),
134
+ ],
131
135
  typeArguments: [marginPool.type],
132
136
  });
133
137
  };