@scallop-io/sui-scallop-sdk 1.4.23 → 1.5.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 (43) hide show
  1. package/dist/constants/index.d.ts +1 -0
  2. package/dist/constants/xoracle.d.ts +2 -0
  3. package/dist/index.js +564 -619
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +574 -630
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/models/scallopIndexer.d.ts +1 -0
  8. package/dist/models/scallopPrice.d.ts +0 -0
  9. package/dist/models/scallopQuery.d.ts +25 -3
  10. package/dist/queries/coreQuery.d.ts +1 -1
  11. package/dist/queries/index.d.ts +1 -0
  12. package/dist/queries/poolAddressesQuery.d.ts +2 -2
  13. package/dist/queries/priceQuery.d.ts +1 -1
  14. package/dist/queries/xOracleQuery.d.ts +13 -0
  15. package/dist/types/address.d.ts +1 -0
  16. package/dist/types/constant/index.d.ts +1 -0
  17. package/dist/types/constant/xOracle.d.ts +9 -0
  18. package/package.json +1 -1
  19. package/src/builders/borrowIncentiveBuilder.ts +11 -25
  20. package/src/builders/coreBuilder.ts +15 -72
  21. package/src/builders/oracle.ts +73 -46
  22. package/src/builders/referralBuilder.ts +9 -20
  23. package/src/builders/spoolBuilder.ts +10 -38
  24. package/src/builders/vescaBuilder.ts +11 -26
  25. package/src/constants/enum.ts +10 -5
  26. package/src/constants/index.ts +1 -0
  27. package/src/constants/poolAddress.ts +343 -184
  28. package/src/constants/testAddress.ts +35 -252
  29. package/src/constants/xoracle.ts +25 -0
  30. package/src/models/scallopIndexer.ts +11 -0
  31. package/src/models/scallopPrice.ts +0 -0
  32. package/src/models/scallopQuery.ts +58 -11
  33. package/src/models/scallopUtils.ts +1 -1
  34. package/src/queries/coreQuery.ts +16 -6
  35. package/src/queries/index.ts +1 -0
  36. package/src/queries/poolAddressesQuery.ts +5 -2
  37. package/src/queries/priceQuery.ts +10 -3
  38. package/src/queries/vescaQuery.ts +8 -17
  39. package/src/queries/xOracleQuery.ts +124 -0
  40. package/src/types/address.ts +1 -0
  41. package/src/types/constant/index.ts +1 -0
  42. package/src/types/constant/xOracle.ts +11 -0
  43. package/src/utils/util.ts +1 -1
@@ -32,6 +32,11 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
32
32
  };
33
33
 
34
34
  const veScaTable = builder.address.get('vesca.table');
35
+ const clockObjectRef = txBlock.sharedObjectRef({
36
+ objectId: SUI_CLOCK_OBJECT_ID,
37
+ mutable: false,
38
+ initialSharedVersion: '1',
39
+ });
35
40
 
36
41
  return {
37
42
  bindToReferral: (veScaKeyId: string) => {
@@ -42,11 +47,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
42
47
  referralIds.referralBindings,
43
48
  txBlock.pure.id(veScaKeyId),
44
49
  veScaTable,
45
- txBlock.sharedObjectRef({
46
- objectId: SUI_CLOCK_OBJECT_ID,
47
- mutable: false,
48
- initialSharedVersion: '1',
49
- }),
50
+ clockObjectRef,
50
51
  ],
51
52
  []
52
53
  );
@@ -62,11 +63,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
62
63
  referralIds.referralBindings,
63
64
  referralIds.authorizedWitnessList,
64
65
  referralIds.referralTiers,
65
- txBlock.sharedObjectRef({
66
- objectId: SUI_CLOCK_OBJECT_ID,
67
- mutable: false,
68
- initialSharedVersion: '1',
69
- }),
66
+ clockObjectRef,
70
67
  ],
71
68
  [coinType]
72
69
  );
@@ -80,11 +77,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
80
77
  referralIds.version,
81
78
  ticket,
82
79
  referralIds.referralRevenuePool,
83
- txBlock.sharedObjectRef({
84
- objectId: SUI_CLOCK_OBJECT_ID,
85
- mutable: false,
86
- initialSharedVersion: '1',
87
- }),
80
+ clockObjectRef,
88
81
  ],
89
82
  [coinType]
90
83
  );
@@ -101,11 +94,7 @@ const generateReferralNormalMethod: GenerateReferralNormalMethod = ({
101
94
  referralIds.version,
102
95
  referralIds.referralRevenuePool,
103
96
  veScaKey,
104
- txBlock.sharedObjectRef({
105
- objectId: SUI_CLOCK_OBJECT_ID,
106
- mutable: false,
107
- initialSharedVersion: '1',
108
- }),
97
+ clockObjectRef,
109
98
  ],
110
99
  [coinType]
111
100
  );
@@ -126,6 +126,12 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
126
126
  const spoolIds: SpoolIds = {
127
127
  spoolPkg: builder.address.get('spool.id'),
128
128
  };
129
+ const clockObjectRef = txBlock.sharedObjectRef({
130
+ objectId: SUI_CLOCK_OBJECT_ID,
131
+ mutable: false,
132
+ initialSharedVersion: '1',
133
+ });
134
+
129
135
  return {
130
136
  createStakeAccount: (stakeMarketCoinName) => {
131
137
  const marketCoinType =
@@ -136,14 +142,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
136
142
  return builder.moveCall(
137
143
  txBlock,
138
144
  `${spoolIds.spoolPkg}::user::new_spool_account`,
139
- [
140
- stakePoolId,
141
- txBlock.sharedObjectRef({
142
- objectId: SUI_CLOCK_OBJECT_ID,
143
- mutable: false,
144
- initialSharedVersion: '1',
145
- }),
146
- ],
145
+ [stakePoolId, clockObjectRef],
147
146
  [marketCoinType]
148
147
  );
149
148
  },
@@ -156,16 +155,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
156
155
  builder.moveCall(
157
156
  txBlock,
158
157
  `${spoolIds.spoolPkg}::user::stake`,
159
- [
160
- stakePoolId,
161
- stakeAccount,
162
- coin,
163
- txBlock.sharedObjectRef({
164
- objectId: SUI_CLOCK_OBJECT_ID,
165
- mutable: false,
166
- initialSharedVersion: '1',
167
- }),
168
- ],
158
+ [stakePoolId, stakeAccount, coin, clockObjectRef],
169
159
  [marketCoinType]
170
160
  );
171
161
  },
@@ -178,16 +168,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
178
168
  return builder.moveCall(
179
169
  txBlock,
180
170
  `${spoolIds.spoolPkg}::user::unstake`,
181
- [
182
- stakePoolId,
183
- stakeAccount,
184
- amount,
185
- txBlock.sharedObjectRef({
186
- objectId: SUI_CLOCK_OBJECT_ID,
187
- mutable: false,
188
- initialSharedVersion: '1',
189
- }),
190
- ],
171
+ [stakePoolId, stakeAccount, amount, clockObjectRef],
191
172
  [marketCoinType]
192
173
  );
193
174
  },
@@ -205,16 +186,7 @@ const generateSpoolNormalMethod: GenerateSpoolNormalMethod = ({
205
186
  return builder.moveCall(
206
187
  txBlock,
207
188
  `${spoolIds.spoolPkg}::user::redeem_rewards`,
208
- [
209
- stakePoolId,
210
- rewardPoolId,
211
- stakeAccount,
212
- txBlock.sharedObjectRef({
213
- objectId: SUI_CLOCK_OBJECT_ID,
214
- mutable: false,
215
- initialSharedVersion: '1',
216
- }),
217
- ],
189
+ [stakePoolId, rewardPoolId, stakeAccount, clockObjectRef],
218
190
  [marketCoinType, rewardCoinType]
219
191
  );
220
192
  },
@@ -87,6 +87,11 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
87
87
  treasury: builder.address.get('vesca.treasury'),
88
88
  config: builder.address.get('vesca.config'),
89
89
  };
90
+ const clockObjectRef = txBlock.sharedObjectRef({
91
+ objectId: SUI_CLOCK_OBJECT_ID,
92
+ mutable: false,
93
+ initialSharedVersion: '1',
94
+ });
90
95
 
91
96
  return {
92
97
  lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
@@ -99,11 +104,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
99
104
  veScaIds.treasury,
100
105
  scaCoin,
101
106
  unlockAtInSecondTimestamp,
102
- txBlock.sharedObjectRef({
103
- objectId: SUI_CLOCK_OBJECT_ID,
104
- mutable: false,
105
- initialSharedVersion: '1',
106
- }),
107
+ clockObjectRef,
107
108
  ],
108
109
  []
109
110
  );
@@ -118,11 +119,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
118
119
  veScaIds.table,
119
120
  veScaIds.treasury,
120
121
  newUnlockAtInSecondTimestamp,
121
- txBlock.sharedObjectRef({
122
- objectId: SUI_CLOCK_OBJECT_ID,
123
- mutable: false,
124
- initialSharedVersion: '1',
125
- }),
122
+ clockObjectRef,
126
123
  ],
127
124
  []
128
125
  );
@@ -137,11 +134,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
137
134
  veScaIds.table,
138
135
  veScaIds.treasury,
139
136
  scaCoin,
140
- txBlock.sharedObjectRef({
141
- objectId: SUI_CLOCK_OBJECT_ID,
142
- mutable: false,
143
- initialSharedVersion: '1',
144
- }),
137
+ clockObjectRef,
145
138
  ],
146
139
  []
147
140
  );
@@ -157,11 +150,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
157
150
  veScaIds.treasury,
158
151
  scaCoin,
159
152
  newUnlockAtInSecondTimestamp,
160
- txBlock.sharedObjectRef({
161
- objectId: SUI_CLOCK_OBJECT_ID,
162
- mutable: false,
163
- initialSharedVersion: '1',
164
- }),
153
+ clockObjectRef,
165
154
  ],
166
155
  []
167
156
  );
@@ -175,11 +164,7 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
175
164
  veScaKey,
176
165
  veScaIds.table,
177
166
  veScaIds.treasury,
178
- txBlock.sharedObjectRef({
179
- objectId: SUI_CLOCK_OBJECT_ID,
180
- mutable: false,
181
- initialSharedVersion: '1',
182
- }),
167
+ clockObjectRef,
183
168
  ],
184
169
  []
185
170
  );
@@ -372,7 +357,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
372
357
  checkVesca(veSca?.unlockAt);
373
358
 
374
359
  if (veSca) {
375
- const sca = await txBlock.redeemSca(veSca.keyId);
360
+ const sca = txBlock.redeemSca(veSca.keyId);
376
361
  if (transferSca) {
377
362
  txBlock.transferObjects([sca], sender);
378
363
  return;
@@ -187,8 +187,10 @@ export const voloCoinIds: types.VoloCoinIds = {
187
187
 
188
188
  // PROD VERSION
189
189
  export const sCoinIds: types.SCoinIds = {
190
- ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
191
- ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
190
+ // ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI', // @TODO: restore on prod
191
+ ssui: '0x88618204de2dfdc2597681a8441ee726b0dc13494c41e319c3264eb7b35fea90::scallop_sui::SCALLOP_SUI',
192
+ // ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA', // @TODO: restore on prod
193
+ ssca: '0x9f64a180373a6b66595025ae16a4ab701f0af1dd5c7ce1ac91dc112e52c2a3f8::scallop_sca::SCALLOP_SCA',
192
194
  scetus:
193
195
  '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
194
196
  // Wormhole assets
@@ -207,7 +209,8 @@ export const sCoinIds: types.SCoinIds = {
207
209
  '0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI',
208
210
  // stable coins
209
211
  susdc:
210
- '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
212
+ // '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC', // @TODO: restore on prod
213
+ '0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
211
214
  swusdc:
212
215
  '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
213
216
  swusdt:
@@ -216,8 +219,10 @@ export const sCoinIds: types.SCoinIds = {
216
219
  '0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
217
220
  // isolated assets
218
221
  sdeep:
219
- '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
220
- sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
222
+ // '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP', // @TODO: restore on prod
223
+ '0x34f0a2e793e1f79ceac72cfe3bb95f65541da449418289ccd12922d16140c882::scallop_deep::SCALLOP_DEEP',
224
+ // sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD', // @TODO: restore on prod
225
+ sfud: '0x3b23c05f917052255a0b16a534dbd4446911aa4a30bd3497cdf5b736551e7ef8::scallop_fud::SCALLOP_FUD',
221
226
  sblub:
222
227
  '0xe72f65446eabfad2103037af2d49d24599106fb44bf4c046c1e7e9acf6844dd0::scallop_blub::SCALLOP_BLUB',
223
228
  // Sui bridge assets
@@ -10,3 +10,4 @@ export * from './rpc';
10
10
  export * from './testAddress';
11
11
  export * from './vesca';
12
12
  export * from './testAddress';
13
+ export * from './xoracle';