@scallop-io/sui-scallop-sdk 0.47.3 → 1.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/builders/borrowIncentiveBuilder.d.ts +2 -2
  2. package/dist/builders/coreBuilder.d.ts +2 -2
  3. package/dist/builders/index.d.ts +2 -2
  4. package/dist/builders/loyaltyProgramBuilder.d.ts +2 -2
  5. package/dist/builders/referralBuilder.d.ts +2 -2
  6. package/dist/builders/sCoinBuilder.d.ts +2 -2
  7. package/dist/builders/spoolBuilder.d.ts +2 -2
  8. package/dist/builders/vescaBuilder.d.ts +2 -2
  9. package/dist/constants/common.d.ts +4 -4
  10. package/dist/constants/index.d.ts +1 -1
  11. package/dist/constants/vesca.d.ts +3 -3
  12. package/dist/index.js +87 -71
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +90 -77
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/models/scallopBuilder.d.ts +10 -8
  17. package/dist/models/scallopCache.d.ts +5 -9
  18. package/dist/models/scallopClient.d.ts +2 -2
  19. package/dist/models/scallopQuery.d.ts +1 -1
  20. package/dist/models/scallopUtils.d.ts +2 -2
  21. package/dist/queries/coreQuery.d.ts +3 -3
  22. package/dist/queries/loyaltyProgramQuery.d.ts +1 -1
  23. package/dist/queries/priceQuery.d.ts +1 -1
  24. package/dist/queries/vescaQuery.d.ts +1 -1
  25. package/dist/test.d.ts +1 -0
  26. package/dist/types/builder/borrowIncentive.d.ts +1 -1
  27. package/dist/types/builder/core.d.ts +16 -16
  28. package/dist/types/builder/spool.d.ts +3 -3
  29. package/dist/types/builder/vesca.d.ts +5 -5
  30. package/dist/types/model.d.ts +4 -4
  31. package/dist/types/query/vesca.d.ts +1 -1
  32. package/dist/utils/query.d.ts +1 -1
  33. package/dist/utils/util.d.ts +1 -0
  34. package/package.json +13 -9
  35. package/src/builders/borrowIncentiveBuilder.ts +6 -6
  36. package/src/builders/coreBuilder.ts +15 -15
  37. package/src/builders/index.ts +2 -2
  38. package/src/builders/loyaltyProgramBuilder.ts +5 -5
  39. package/src/builders/oracle.ts +5 -4
  40. package/src/builders/referralBuilder.ts +6 -6
  41. package/src/builders/sCoinBuilder.ts +5 -8
  42. package/src/builders/spoolBuilder.ts +9 -9
  43. package/src/builders/vescaBuilder.ts +5 -5
  44. package/src/constants/common.ts +4 -4
  45. package/src/constants/index.ts +1 -1
  46. package/src/constants/vesca.ts +5 -6
  47. package/src/models/scallopBuilder.ts +14 -7
  48. package/src/models/scallopCache.ts +43 -34
  49. package/src/models/scallopClient.ts +8 -6
  50. package/src/models/scallopQuery.ts +2 -2
  51. package/src/models/scallopUtils.ts +3 -3
  52. package/src/queries/borrowIncentiveQuery.ts +1 -1
  53. package/src/queries/coreQuery.ts +4 -4
  54. package/src/queries/loyaltyProgramQuery.ts +1 -1
  55. package/src/queries/priceQuery.ts +1 -1
  56. package/src/queries/sCoinQuery.ts +2 -2
  57. package/src/queries/spoolQuery.ts +4 -5
  58. package/src/queries/vescaQuery.ts +6 -3
  59. package/src/test.ts +26 -0
  60. package/src/types/address.ts +26 -26
  61. package/src/types/builder/borrowIncentive.ts +1 -1
  62. package/src/types/builder/core.ts +26 -28
  63. package/src/types/builder/spool.ts +2 -3
  64. package/src/types/builder/vesca.ts +5 -9
  65. package/src/types/model.ts +4 -7
  66. package/src/types/query/vesca.ts +1 -1
  67. package/src/utils/query.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { TransactionBlock } from '@mysten/sui.js/transactions';
1
+ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
3
3
  import type { ScallopBuilder } from 'src/models';
4
4
  import type { BorrowIncentiveTxBlock, ScallopTxBlock } from '../types';
@@ -9,4 +9,4 @@ import type { BorrowIncentiveTxBlock, ScallopTxBlock } from '../types';
9
9
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return Scallop borrow incentive txBlock.
11
11
  */
12
- export declare const newBorrowIncentiveTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock) => BorrowIncentiveTxBlock;
12
+ export declare const newBorrowIncentiveTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => BorrowIncentiveTxBlock;
@@ -1,4 +1,4 @@
1
- import { TransactionBlock } from '@mysten/sui.js/transactions';
1
+ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
3
3
  import type { ScallopBuilder } from '../models';
4
4
  import type { CoreTxBlock, ScallopTxBlock, SuiTxBlockWithSpool } from '../types';
@@ -9,4 +9,4 @@ import type { CoreTxBlock, ScallopTxBlock, SuiTxBlockWithSpool } from '../types'
9
9
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return Scallop core txBlock.
11
11
  */
12
- export declare const newCoreTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock | SuiTxBlockWithSpool) => CoreTxBlock;
12
+ export declare const newCoreTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | SuiTxBlockWithSpool) => CoreTxBlock;
@@ -1,4 +1,4 @@
1
- import { TransactionBlock } from '@mysten/sui.js/transactions';
1
+ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
3
3
  import type { ScallopBuilder } from '../models';
4
4
  import type { ScallopTxBlock } from '../types';
@@ -9,4 +9,4 @@ import type { ScallopTxBlock } from '../types';
9
9
  * @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return ScallopTxBlock.
11
11
  */
12
- export declare const newScallopTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock) => ScallopTxBlock;
12
+ export declare const newScallopTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => ScallopTxBlock;
@@ -1,4 +1,4 @@
1
- import { TransactionBlock } from '@mysten/sui.js/transactions';
1
+ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
3
3
  import { ScallopBuilder } from 'src/models';
4
4
  import { LoyaltyProgramTxBlock, ScallopTxBlock } from 'src/types';
@@ -9,4 +9,4 @@ import { LoyaltyProgramTxBlock, ScallopTxBlock } from 'src/types';
9
9
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return Scallop loyalty program txBlock.
11
11
  */
12
- export declare const newLoyaltyProgramTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock) => LoyaltyProgramTxBlock;
12
+ export declare const newLoyaltyProgramTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => LoyaltyProgramTxBlock;
@@ -1,6 +1,6 @@
1
1
  import { ScallopBuilder } from 'src/models';
2
2
  import { ScallopTxBlock } from 'src/types';
3
- import { SuiTxBlock as SuiKitTxBlock, TransactionBlock } from '@scallop-io/sui-kit';
3
+ import { SuiTxBlock as SuiKitTxBlock, Transaction } from '@scallop-io/sui-kit';
4
4
  import { ReferralTxBlock } from 'src/types/builder/referral';
5
5
  /**
6
6
  * Create an enhanced transaction block instance for interaction with borrow incentive modules of the Scallop contract.
@@ -9,4 +9,4 @@ import { ReferralTxBlock } from 'src/types/builder/referral';
9
9
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return Scallop referral txBlock.
11
11
  */
12
- export declare const newReferralTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock) => ReferralTxBlock;
12
+ export declare const newReferralTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => ReferralTxBlock;
@@ -1,4 +1,4 @@
1
- import { TransactionBlock, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
1
+ import { Transaction, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
2
  import { ScallopBuilder } from 'src/models';
3
3
  import { BaseScallopTxBlock, SCoinTxBlock, ScallopTxBlock } from 'src/types';
4
- export declare const newSCoinTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock | BaseScallopTxBlock) => SCoinTxBlock;
4
+ export declare const newSCoinTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | BaseScallopTxBlock) => SCoinTxBlock;
@@ -1,4 +1,4 @@
1
- import { TransactionBlock } from '@mysten/sui.js/transactions';
1
+ import { Transaction } from '@mysten/sui/transactions';
2
2
  import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
3
3
  import type { ScallopBuilder } from '../models';
4
4
  import type { SpoolTxBlock, ScallopTxBlock, SuiTxBlockWithSCoin } from '../types';
@@ -9,4 +9,4 @@ import type { SpoolTxBlock, ScallopTxBlock, SuiTxBlockWithSCoin } from '../types
9
9
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
10
10
  * @return Scallop spool txBlock.
11
11
  */
12
- export declare const newSpoolTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock | SuiTxBlockWithSCoin) => SpoolTxBlock;
12
+ export declare const newSpoolTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | SuiTxBlockWithSCoin) => SpoolTxBlock;
@@ -1,4 +1,4 @@
1
- import { SuiTxBlock, TransactionBlock, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
1
+ import { SuiTxBlock, Transaction, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
2
  import { ScallopBuilder } from '../models';
3
3
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
4
4
  import type { ScallopTxBlock, VeScaTxBlock } from 'src/types';
@@ -22,4 +22,4 @@ export declare const requireVeSca: (builder: ScallopBuilder, SuiTxBlock: SuiTxBl
22
22
  * @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
23
23
  * @return Scallop borrow incentive txBlock.
24
24
  */
25
- export declare const newVeScaTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | TransactionBlock) => VeScaTxBlock;
25
+ export declare const newVeScaTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => VeScaTxBlock;
@@ -1,7 +1,7 @@
1
- export declare const API_BASE_URL = "https://sui.apis.scallop.io";
2
- export declare const SDK_API_BASE_URL = "https://sdk.api.scallop.io";
3
- export declare const IS_VE_SCA_TEST = false;
4
- export declare const USE_TEST_ADDRESS = false;
1
+ export declare const API_BASE_URL: "https://sui.apis.scallop.io";
2
+ export declare const SDK_API_BASE_URL: "https://sdk.api.scallop.io";
3
+ export declare const IS_VE_SCA_TEST: boolean;
4
+ export declare const USE_TEST_ADDRESS: boolean;
5
5
  export declare const ADDRESSES_ID: "65fb07c39c845425d71d7b18" | "66f8e7ed9bb9e07fdfb86bbb";
6
6
  export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
7
7
  export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
@@ -1,4 +1,4 @@
1
1
  export * from './common';
2
2
  export * from './enum';
3
- export * from './vesca';
4
3
  export * from './flashloan';
4
+ export * from './vesca';
@@ -1,5 +1,5 @@
1
1
  export declare const UNLOCK_ROUND_DURATION: number;
2
- export declare const MAX_LOCK_ROUNDS: number;
2
+ export declare const MAX_LOCK_ROUNDS: 1460;
3
3
  export declare const MAX_LOCK_DURATION: number;
4
- export declare const MIN_INITIAL_LOCK_AMOUNT: number;
5
- export declare const MIN_TOP_UP_AMOUNT: number;
4
+ export declare const MIN_INITIAL_LOCK_AMOUNT: 10000000000;
5
+ export declare const MIN_TOP_UP_AMOUNT: 1000000000;
package/dist/index.js CHANGED
@@ -318,13 +318,6 @@ var sCoinIds = {
318
318
  swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC"
319
319
  };
320
320
 
321
- // src/constants/vesca.ts
322
- var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
323
- var MAX_LOCK_ROUNDS = 1460;
324
- var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
325
- var MIN_INITIAL_LOCK_AMOUNT = 1e10;
326
- var MIN_TOP_UP_AMOUNT = 1e9;
327
-
328
321
  // src/constants/flashloan.ts
329
322
  var FlashLoanFeeObjectMap = {
330
323
  vsui: "0x0069cddee7a5c0b1d34beb5ef0620f978096525f1830b055f38b110f40d73fbb",
@@ -341,6 +334,13 @@ var FlashLoanFeeObjectMap = {
341
334
  wsol: "0xe84bdb35b790fc7bdd1645122ac6ac0fc904531d6772c9e25904fece322c5f34"
342
335
  };
343
336
 
337
+ // src/constants/vesca.ts
338
+ var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
339
+ var MAX_LOCK_ROUNDS = 1460;
340
+ var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
341
+ var MIN_INITIAL_LOCK_AMOUNT = 1e10;
342
+ var MIN_TOP_UP_AMOUNT = 1e9;
343
+
344
344
  // src/models/scallop.ts
345
345
  var import_sui_kit16 = require("@scallop-io/sui-kit");
346
346
 
@@ -465,7 +465,7 @@ var checkRenewExpiredVeSca = (scaAmount, lockPeriodInDays, prevUnlockAtInMillisT
465
465
 
466
466
  // src/utils/query.ts
467
467
  var import_bignumber = __toESM(require("bignumber.js"));
468
- var import_utils = require("@mysten/sui.js/utils");
468
+ var import_utils = require("@mysten/sui/utils");
469
469
  var parseOriginMarketPoolData = (originMarketPoolData) => {
470
470
  return {
471
471
  coinType: (0, import_utils.normalizeStructTag)(originMarketPoolData.type.name),
@@ -1002,21 +1002,40 @@ var ScallopCache = class {
1002
1002
  refetchType
1003
1003
  });
1004
1004
  }
1005
- /**
1006
- * @description Cache protocol config call for 60 seconds.
1007
- * @returns Promise<ProtocolConfig>
1008
- */
1009
- async getProtocolConfig() {
1010
- return await this.queryClient.fetchQuery({
1011
- queryKey: ["getProtocolConfig"],
1012
- queryFn: async () => {
1013
- return await callWithRateLimit(
1014
- this.tokenBucket,
1015
- () => this.client.getProtocolConfig()
1016
- );
1017
- },
1018
- staleTime: 3e4
1019
- });
1005
+ async resolveArgs(txb, args) {
1006
+ return await Promise.all(
1007
+ args.map(async (arg) => {
1008
+ if (typeof arg === "string") {
1009
+ const objData = (await this.queryGetObject(arg, { showOwner: true }))?.data;
1010
+ if (!objData)
1011
+ return arg;
1012
+ const owner = objData?.owner;
1013
+ if (!owner)
1014
+ return arg;
1015
+ if ("Shared" in owner) {
1016
+ return txb.sharedObjectRef({
1017
+ objectId: objData.objectId,
1018
+ initialSharedVersion: owner.Shared.initial_shared_version,
1019
+ mutable: true
1020
+ });
1021
+ } else {
1022
+ return txb.objectRef({
1023
+ objectId: objData.objectId,
1024
+ version: objData.version,
1025
+ digest: objData.digest
1026
+ });
1027
+ }
1028
+ } else if ("objectId" in arg && "version" in arg && "digest" in arg) {
1029
+ return txb.objectRef({
1030
+ objectId: arg.objectId,
1031
+ version: arg.version,
1032
+ digest: arg.digest
1033
+ });
1034
+ } else {
1035
+ return arg;
1036
+ }
1037
+ })
1038
+ );
1020
1039
  }
1021
1040
  /**
1022
1041
  * @description Provides cache for inspectTxn of the SuiKit.
@@ -1030,20 +1049,8 @@ var ScallopCache = class {
1030
1049
  typeArgs
1031
1050
  }) {
1032
1051
  const txBlock = new import_sui_kit.SuiTxBlock();
1033
- const resolvedArgs = await Promise.all(
1034
- args.map(async (arg) => {
1035
- if (typeof arg === "string") {
1036
- return (await this.queryGetObject(arg, { showContent: true }))?.data;
1037
- }
1038
- return arg;
1039
- })
1040
- );
1052
+ const resolvedArgs = await this.resolveArgs(txBlock, args);
1041
1053
  txBlock.moveCall(queryTarget, resolvedArgs, typeArgs);
1042
- const txBytes = await txBlock.txBlock.build({
1043
- client: this.client,
1044
- onlyTransactionKind: true,
1045
- protocolConfig: await this.getProtocolConfig() ?? void 0
1046
- });
1047
1054
  const query = await this.queryClient.fetchQuery({
1048
1055
  queryKey: typeArgs ? ["inspectTxn", queryTarget, JSON.stringify(args)] : [
1049
1056
  "inspectTxn",
@@ -1054,7 +1061,7 @@ var ScallopCache = class {
1054
1061
  queryFn: async () => {
1055
1062
  return await callWithRateLimit(
1056
1063
  this.tokenBucket,
1057
- () => this.suiKit.inspectTxn(txBytes)
1064
+ () => this.suiKit.inspectTxn(txBlock)
1058
1065
  );
1059
1066
  }
1060
1067
  });
@@ -2275,16 +2282,16 @@ var ScallopAddress = class {
2275
2282
  };
2276
2283
 
2277
2284
  // src/models/scallopClient.ts
2278
- var import_utils25 = require("@mysten/sui.js/utils");
2285
+ var import_utils25 = require("@mysten/sui/utils");
2279
2286
  var import_sui_kit15 = require("@scallop-io/sui-kit");
2280
2287
 
2281
2288
  // src/models/scallopUtils.ts
2282
- var import_utils10 = require("@mysten/sui.js/utils");
2289
+ var import_utils10 = require("@mysten/sui/utils");
2283
2290
  var import_sui_kit4 = require("@scallop-io/sui-kit");
2284
2291
  var import_pyth_sui_js = require("@pythnetwork/pyth-sui-js");
2285
2292
 
2286
2293
  // src/queries/coreQuery.ts
2287
- var import_utils3 = require("@mysten/sui.js/utils");
2294
+ var import_utils3 = require("@mysten/sui/utils");
2288
2295
  var import_bignumber2 = __toESM(require("bignumber.js"));
2289
2296
 
2290
2297
  // src/queries/supplyLimit.ts
@@ -2939,7 +2946,7 @@ var getFlashLoanFees = async (query, assetNames) => {
2939
2946
  };
2940
2947
 
2941
2948
  // src/queries/spoolQuery.ts
2942
- var import_utils5 = require("@mysten/sui.js/utils");
2949
+ var import_utils5 = require("@mysten/sui/utils");
2943
2950
  var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexer = false) => {
2944
2951
  const stakeCoinNames = stakeMarketCoinNames.map(
2945
2952
  (stakeMarketCoinName) => query.utils.parseCoinName(stakeMarketCoinName)
@@ -3335,7 +3342,7 @@ var getStakeRewardPool = async ({
3335
3342
  };
3336
3343
 
3337
3344
  // src/queries/borrowIncentiveQuery.ts
3338
- var import_utils7 = require("@mysten/sui.js/utils");
3345
+ var import_utils7 = require("@mysten/sui/utils");
3339
3346
  var import_bignumber3 = __toESM(require("bignumber.js"));
3340
3347
  var queryBorrowIncentivePools = async (address) => {
3341
3348
  const queryPkgId = address.get("borrowIncentive.query");
@@ -4122,8 +4129,9 @@ var getTotalValueLocked = async (query, indexer = false) => {
4122
4129
  // src/queries/vescaQuery.ts
4123
4130
  var import_bignumber5 = __toESM(require("bignumber.js"));
4124
4131
  var import_sui_kit3 = require("@scallop-io/sui-kit");
4125
- var import_bcs = require("@mysten/sui.js/bcs");
4132
+ var import_bcs = require("@mysten/sui/bcs");
4126
4133
  var import_zod2 = require("zod");
4134
+ var import_assert = __toESM(require("assert"));
4127
4135
  var getVescaKeys = async (utils, ownerAddress) => {
4128
4136
  const owner = ownerAddress || utils.suiKit.currentAddress();
4129
4137
  const veScaObjId = utils.address.get("vesca.object");
@@ -4257,7 +4265,8 @@ var getTotalVeScaTreasuryAmount = async (utils, veScaTreasury) => {
4257
4265
  if (results && results[1].returnValues) {
4258
4266
  const value = Uint8Array.from(results[1].returnValues[0][0]);
4259
4267
  const type = results[1].returnValues[0][1];
4260
- return import_bcs.bcs.de(type, value);
4268
+ (0, import_assert.default)(type === "u64", "Result type is not u64");
4269
+ return import_bcs.bcs.u64().parse(value);
4261
4270
  }
4262
4271
  return "0";
4263
4272
  };
@@ -4794,17 +4803,18 @@ var ScallopUtils = class {
4794
4803
  };
4795
4804
 
4796
4805
  // src/models/scallopBuilder.ts
4797
- var import_utils24 = require("@mysten/sui.js/utils");
4806
+ var import_utils24 = require("@mysten/sui/utils");
4798
4807
  var import_sui_kit14 = require("@scallop-io/sui-kit");
4799
4808
 
4800
4809
  // src/builders/coreBuilder.ts
4801
- var import_transactions = require("@mysten/sui.js/transactions");
4802
- var import_utils13 = require("@mysten/sui.js/utils");
4810
+ var import_transactions2 = require("@mysten/sui/transactions");
4811
+ var import_utils13 = require("@mysten/sui/utils");
4803
4812
  var import_sui_kit5 = require("@scallop-io/sui-kit");
4804
4813
 
4805
4814
  // src/builders/oracle.ts
4806
- var import_utils12 = require("@mysten/sui.js/utils");
4815
+ var import_utils12 = require("@mysten/sui/utils");
4807
4816
  var import_pyth_sui_js2 = require("@pythnetwork/pyth-sui-js");
4817
+ var import_transactions = require("@mysten/sui.js/transactions");
4808
4818
  var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
4809
4819
  const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
4810
4820
  assetCoinNames = assetCoinNames ?? [
@@ -4813,7 +4823,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
4813
4823
  const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
4814
4824
  if (usePythPullModel && rules.includes("pyth")) {
4815
4825
  const pythClient = new import_pyth_sui_js2.SuiPythClient(
4816
- builder.suiKit.client(),
4826
+ builder.oldSuiClient,
4817
4827
  builder.address.get("core.oracles.pyth.state"),
4818
4828
  builder.address.get("core.oracles.pyth.wormholeState")
4819
4829
  );
@@ -4826,7 +4836,8 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
4826
4836
  const pythConnection = new import_pyth_sui_js2.SuiPriceServiceConnection(endpoint);
4827
4837
  const priceUpdateData = await pythConnection.getPriceFeedsUpdateData(priceIds);
4828
4838
  await pythClient.updatePriceFeeds(
4829
- txBlock.txBlock,
4839
+ import_transactions.TransactionBlock.from(txBlock.serialize()),
4840
+ // convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
4830
4841
  priceUpdateData,
4831
4842
  priceIds
4832
4843
  );
@@ -5007,7 +5018,7 @@ var generateCoreNormalMethod = ({
5007
5018
  obligationKey,
5008
5019
  coreIds.market,
5009
5020
  coreIds.coinDecimalsRegistry,
5010
- amount,
5021
+ txBlock.pure.u64(amount),
5011
5022
  coreIds.xOracle,
5012
5023
  import_utils13.SUI_CLOCK_OBJECT_ID
5013
5024
  ],
@@ -5074,7 +5085,7 @@ var generateCoreNormalMethod = ({
5074
5085
  coreIds.market,
5075
5086
  coreIds.coinDecimalsRegistry,
5076
5087
  borrowReferral,
5077
- amount,
5088
+ txBlock.pure.u64(amount),
5078
5089
  coreIds.xOracle,
5079
5090
  import_utils13.SUI_CLOCK_OBJECT_ID
5080
5091
  ],
@@ -5091,7 +5102,7 @@ var generateCoreNormalMethod = ({
5091
5102
  obligationKey,
5092
5103
  coreIds.market,
5093
5104
  coreIds.coinDecimalsRegistry,
5094
- amount,
5105
+ txBlock.pure.u64(amount),
5095
5106
  coreIds.xOracle,
5096
5107
  import_utils13.SUI_CLOCK_OBJECT_ID
5097
5108
  ],
@@ -5309,7 +5320,7 @@ var generateCoreQuickMethod = ({
5309
5320
  };
5310
5321
  };
5311
5322
  var newCoreTxBlock = (builder, initTxBlock) => {
5312
- const txBlock = initTxBlock instanceof import_transactions.TransactionBlock ? new import_sui_kit5.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit5.SuiTxBlock();
5323
+ const txBlock = initTxBlock instanceof import_transactions2.Transaction ? new import_sui_kit5.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit5.SuiTxBlock();
5313
5324
  const normalMethod = generateCoreNormalMethod({
5314
5325
  builder,
5315
5326
  txBlock
@@ -5337,8 +5348,8 @@ var newCoreTxBlock = (builder, initTxBlock) => {
5337
5348
  };
5338
5349
 
5339
5350
  // src/builders/spoolBuilder.ts
5340
- var import_transactions2 = require("@mysten/sui.js/transactions");
5341
- var import_utils15 = require("@mysten/sui.js/utils");
5351
+ var import_transactions3 = require("@mysten/sui/transactions");
5352
+ var import_utils15 = require("@mysten/sui/utils");
5342
5353
  var import_sui_kit6 = require("@scallop-io/sui-kit");
5343
5354
  var requireStakeAccountIds = async (...params) => {
5344
5355
  const [builder, txBlock, stakeMarketCoinName, stakeAccountId] = params;
@@ -5531,7 +5542,7 @@ var generateSpoolQuickMethod = ({
5531
5542
  };
5532
5543
  };
5533
5544
  var newSpoolTxBlock = (builder, initTxBlock) => {
5534
- const txBlock = initTxBlock instanceof import_transactions2.TransactionBlock ? new import_sui_kit6.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit6.SuiTxBlock();
5545
+ const txBlock = initTxBlock instanceof import_transactions3.Transaction ? new import_sui_kit6.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit6.SuiTxBlock();
5535
5546
  const normalMethod = generateSpoolNormalMethod({
5536
5547
  builder,
5537
5548
  txBlock
@@ -5559,8 +5570,8 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
5559
5570
  };
5560
5571
 
5561
5572
  // src/builders/borrowIncentiveBuilder.ts
5562
- var import_transactions3 = require("@mysten/sui.js/transactions");
5563
- var import_utils17 = require("@mysten/sui.js/utils");
5573
+ var import_transactions4 = require("@mysten/sui/transactions");
5574
+ var import_utils17 = require("@mysten/sui/utils");
5564
5575
  var import_sui_kit7 = require("@scallop-io/sui-kit");
5565
5576
  var requireObligationInfo2 = async (...params) => {
5566
5577
  const [builder, txBlock, obligationId, obligationKey] = params;
@@ -5761,7 +5772,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
5761
5772
  };
5762
5773
  };
5763
5774
  var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
5764
- const txBlock = initTxBlock instanceof import_transactions3.TransactionBlock ? new import_sui_kit7.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit7.SuiTxBlock();
5775
+ const txBlock = initTxBlock instanceof import_transactions4.Transaction ? new import_sui_kit7.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit7.SuiTxBlock();
5765
5776
  const normalMethod = generateBorrowIncentiveNormalMethod({
5766
5777
  builder,
5767
5778
  txBlock
@@ -6037,7 +6048,7 @@ var generateQuickVeScaMethod = ({
6037
6048
  };
6038
6049
  };
6039
6050
  var newVeScaTxBlock = (builder, initTxBlock) => {
6040
- const txBlock = initTxBlock instanceof import_sui_kit8.TransactionBlock ? new import_sui_kit8.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit8.SuiTxBlock();
6051
+ const txBlock = initTxBlock instanceof import_sui_kit8.Transaction ? new import_sui_kit8.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit8.SuiTxBlock();
6041
6052
  const normalMethod = generateNormalVeScaMethod({
6042
6053
  builder,
6043
6054
  txBlock
@@ -6087,7 +6098,7 @@ var generateReferralNormalMethod = ({
6087
6098
  `${referralIds.referralPgkId}::referral_bindings::bind_ve_sca_referrer`,
6088
6099
  [
6089
6100
  referralIds.referralBindings,
6090
- txBlock.pure(veScaKeyId),
6101
+ txBlock.pure.id(veScaKeyId),
6091
6102
  veScaTable,
6092
6103
  import_sui_kit9.SUI_CLOCK_OBJECT_ID
6093
6104
  ],
@@ -6171,7 +6182,7 @@ var generateReferralQuickMethod = ({
6171
6182
  };
6172
6183
  };
6173
6184
  var newReferralTxBlock = (builder, initTxBlock) => {
6174
- const txBlock = initTxBlock instanceof import_sui_kit9.TransactionBlock ? new import_sui_kit9.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit9.SuiTxBlock();
6185
+ const txBlock = initTxBlock instanceof import_sui_kit9.Transaction ? new import_sui_kit9.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit9.SuiTxBlock();
6175
6186
  const normalMethod = generateReferralNormalMethod({
6176
6187
  builder,
6177
6188
  txBlock
@@ -6199,7 +6210,7 @@ var newReferralTxBlock = (builder, initTxBlock) => {
6199
6210
  };
6200
6211
 
6201
6212
  // src/builders/loyaltyProgramBuilder.ts
6202
- var import_transactions4 = require("@mysten/sui.js/transactions");
6213
+ var import_transactions5 = require("@mysten/sui/transactions");
6203
6214
  var import_sui_kit10 = require("@scallop-io/sui-kit");
6204
6215
  var generateLoyaltyProgramNormalMethod = ({ builder, txBlock }) => {
6205
6216
  const loyaltyProgramIds = {
@@ -6240,7 +6251,7 @@ var generateLoyaltyProgramQuickMethod = ({
6240
6251
  };
6241
6252
  };
6242
6253
  var newLoyaltyProgramTxBlock = (builder, initTxBlock) => {
6243
- const txBlock = initTxBlock instanceof import_transactions4.TransactionBlock ? new import_sui_kit10.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit10.SuiTxBlock();
6254
+ const txBlock = initTxBlock instanceof import_transactions5.Transaction ? new import_sui_kit10.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit10.SuiTxBlock();
6244
6255
  const normalMethod = generateLoyaltyProgramNormalMethod({
6245
6256
  builder,
6246
6257
  txBlock
@@ -6329,7 +6340,7 @@ var generateSCoinQuickMethod = ({
6329
6340
  };
6330
6341
  };
6331
6342
  var newSCoinTxBlock = (builder, initTxBlock) => {
6332
- const txBlock = initTxBlock instanceof import_sui_kit11.TransactionBlock ? new import_sui_kit11.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit11.SuiTxBlock();
6343
+ const txBlock = initTxBlock instanceof import_sui_kit11.Transaction ? new import_sui_kit11.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit11.SuiTxBlock();
6333
6344
  const normalMethod = generateSCoinNormalMethod({
6334
6345
  builder,
6335
6346
  txBlock
@@ -6561,8 +6572,8 @@ var ScallopIndexer = class {
6561
6572
  };
6562
6573
 
6563
6574
  // src/queries/sCoinQuery.ts
6564
- var import_bcs2 = require("@mysten/sui.js/bcs");
6565
- var import_assert = __toESM(require("assert"));
6575
+ var import_bcs2 = require("@mysten/sui/bcs");
6576
+ var import_assert2 = __toESM(require("assert"));
6566
6577
  var import_bignumber7 = __toESM(require("bignumber.js"));
6567
6578
  var getSCoinTotalSupply = async ({
6568
6579
  utils
@@ -6583,8 +6594,8 @@ var getSCoinTotalSupply = async ({
6583
6594
  if (results && results[0].returnValues) {
6584
6595
  const value = Uint8Array.from(results[0].returnValues[0][0]);
6585
6596
  const type = results[0].returnValues[0][1];
6586
- (0, import_assert.default)(type === "u64", "Result type is not u64");
6587
- return (0, import_bignumber7.default)(import_bcs2.bcs.de(type, value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
6597
+ (0, import_assert2.default)(type === "u64", "Result type is not u64");
6598
+ return (0, import_bignumber7.default)(import_bcs2.bcs.u64().parse(value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
6588
6599
  }
6589
6600
  return 0;
6590
6601
  };
@@ -6654,7 +6665,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
6654
6665
  };
6655
6666
 
6656
6667
  // src/models/scallopQuery.ts
6657
- var import_utils23 = require("@mysten/sui.js/utils");
6668
+ var import_utils23 = require("@mysten/sui/utils");
6658
6669
  var ScallopQuery = class {
6659
6670
  constructor(params, instance) {
6660
6671
  this.params = params;
@@ -7142,6 +7153,7 @@ var ScallopQuery = class {
7142
7153
  };
7143
7154
 
7144
7155
  // src/models/scallopBuilder.ts
7156
+ var import_client = require("@mysten/sui.js/client");
7145
7157
  var ScallopBuilder = class {
7146
7158
  constructor(params, instance) {
7147
7159
  this.suiKit = instance?.suiKit ?? new import_sui_kit14.SuiKit(params);
@@ -7182,6 +7194,9 @@ var ScallopBuilder = class {
7182
7194
  );
7183
7195
  }
7184
7196
  this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
7197
+ this.oldSuiClient = new import_client.SuiClient({
7198
+ url: this.suiKit.suiInteractor.currentFullNode
7199
+ });
7185
7200
  }
7186
7201
  /**
7187
7202
  * Request the scallop API to initialize data.
@@ -7703,6 +7718,7 @@ var ScallopClient = class {
7703
7718
  false
7704
7719
  );
7705
7720
  const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
7721
+ console.log(stakeMarketCoin, stakeCoinName);
7706
7722
  if (stakeMarketCoin) {
7707
7723
  const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
7708
7724
  await this.utils.mergeSimilarCoins(