@scallop-io/sui-scallop-sdk 1.4.15-rc.2 → 1.4.16

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 (69) hide show
  1. package/dist/constants/common.d.ts +6 -6
  2. package/dist/constants/enum.d.ts +2 -2
  3. package/dist/constants/index.d.ts +0 -1
  4. package/dist/constants/poolAddress.d.ts +2 -0
  5. package/dist/constants/queryKeys.d.ts +3 -4
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.js +2087 -1617
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2054 -1579
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/models/scallop.d.ts +1 -2
  12. package/dist/models/scallopBuilder.d.ts +2 -1
  13. package/dist/models/scallopCache.d.ts +18 -12
  14. package/dist/models/scallopQuery.d.ts +98 -11
  15. package/dist/models/scallopUtils.d.ts +4 -4
  16. package/dist/queries/borrowIncentiveQuery.d.ts +6 -1
  17. package/dist/queries/coreQuery.d.ts +2 -0
  18. package/dist/queries/objectsQuery.d.ts +1 -2
  19. package/dist/queries/poolAddressesQuery.d.ts +5 -1
  20. package/dist/queries/portfolioQuery.d.ts +71 -5
  21. package/dist/queries/priceQuery.d.ts +4 -0
  22. package/dist/queries/sCoinQuery.d.ts +1 -1
  23. package/dist/types/builder/core.d.ts +6 -6
  24. package/dist/types/model.d.ts +8 -2
  25. package/dist/utils/index.d.ts +0 -2
  26. package/package.json +7 -7
  27. package/src/builders/borrowIncentiveBuilder.ts +11 -5
  28. package/src/builders/coreBuilder.ts +62 -33
  29. package/src/builders/loyaltyProgramBuilder.ts +3 -2
  30. package/src/builders/referralBuilder.ts +16 -6
  31. package/src/builders/sCoinBuilder.ts +6 -4
  32. package/src/builders/spoolBuilder.ts +14 -7
  33. package/src/builders/vescaBuilder.ts +13 -7
  34. package/src/constants/coinGecko.ts +2 -0
  35. package/src/constants/common.ts +7 -1
  36. package/src/constants/enum.ts +46 -20
  37. package/src/constants/index.ts +0 -1
  38. package/src/constants/poolAddress.ts +252 -66
  39. package/src/constants/pyth.ts +2 -0
  40. package/src/constants/queryKeys.ts +7 -9
  41. package/src/constants/testAddress.ts +24 -0
  42. package/src/index.ts +0 -1
  43. package/src/models/scallop.ts +9 -13
  44. package/src/models/scallopAddress.ts +2 -9
  45. package/src/models/scallopBuilder.ts +62 -8
  46. package/src/models/scallopCache.ts +236 -82
  47. package/src/models/scallopClient.ts +4 -6
  48. package/src/models/scallopIndexer.ts +1 -5
  49. package/src/models/scallopQuery.ts +62 -25
  50. package/src/models/scallopUtils.ts +9 -13
  51. package/src/queries/borrowIncentiveQuery.ts +6 -13
  52. package/src/queries/coreQuery.ts +88 -54
  53. package/src/queries/loyaltyProgramQuery.ts +1 -3
  54. package/src/queries/objectsQuery.ts +1 -3
  55. package/src/queries/poolAddressesQuery.ts +16 -7
  56. package/src/queries/portfolioQuery.ts +253 -21
  57. package/src/queries/priceQuery.ts +2 -7
  58. package/src/queries/sCoinQuery.ts +2 -2
  59. package/src/queries/spoolQuery.ts +21 -20
  60. package/src/queries/vescaQuery.ts +3 -7
  61. package/src/types/builder/core.ts +24 -5
  62. package/src/types/model.ts +13 -2
  63. package/src/utils/index.ts +0 -2
  64. package/src/utils/indexer.ts +3 -1
  65. package/src/utils/query.ts +2 -2
  66. package/dist/constants/tokenBucket.d.ts +0 -2
  67. package/dist/utils/tokenBucket.d.ts +0 -11
  68. package/src/constants/tokenBucket.ts +0 -2
  69. package/src/utils/tokenBucket.ts +0 -68
@@ -90,7 +90,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
90
90
 
91
91
  return {
92
92
  lockSca: (scaCoin, unlockAtInSecondTimestamp) => {
93
- return txBlock.moveCall(
93
+ return builder.moveCall(
94
+ txBlock,
94
95
  `${veScaIds.pkgId}::ve_sca::mint_ve_sca_key`,
95
96
  [
96
97
  veScaIds.config,
@@ -104,7 +105,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
104
105
  );
105
106
  },
106
107
  extendLockPeriod: (veScaKey, newUnlockAtInSecondTimestamp) => {
107
- txBlock.moveCall(
108
+ builder.moveCall(
109
+ txBlock,
108
110
  `${veScaIds.pkgId}::ve_sca::extend_lock_period`,
109
111
  [
110
112
  veScaIds.config,
@@ -118,7 +120,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
118
120
  );
119
121
  },
120
122
  extendLockAmount: (veScaKey, scaCoin) => {
121
- txBlock.moveCall(
123
+ builder.moveCall(
124
+ txBlock,
122
125
  `${veScaIds.pkgId}::ve_sca::lock_more_sca`,
123
126
  [
124
127
  veScaIds.config,
@@ -132,7 +135,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
132
135
  );
133
136
  },
134
137
  renewExpiredVeSca: (veScaKey, scaCoin, newUnlockAtInSecondTimestamp) => {
135
- txBlock.moveCall(
138
+ builder.moveCall(
139
+ txBlock,
136
140
  `${veScaIds.pkgId}::ve_sca::renew_expired_ve_sca`,
137
141
  [
138
142
  veScaIds.config,
@@ -147,7 +151,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
147
151
  );
148
152
  },
149
153
  redeemSca: (veScaKey) => {
150
- return txBlock.moveCall(
154
+ return builder.moveCall(
155
+ txBlock,
151
156
  `${veScaIds.pkgId}::ve_sca::redeem`,
152
157
  [
153
158
  veScaIds.config,
@@ -160,7 +165,8 @@ const generateNormalVeScaMethod: GenerateVeScaNormalMethod = ({
160
165
  );
161
166
  },
162
167
  mintEmptyVeSca: () => {
163
- return txBlock.moveCall(
168
+ return builder.moveCall(
169
+ txBlock,
164
170
  `${veScaIds.pkgId}::ve_sca::mint_ve_sca_placeholder_key`,
165
171
  [veScaIds.config, veScaIds.table],
166
172
  []
@@ -346,7 +352,7 @@ const generateQuickVeScaMethod: GenerateVeScaQuickMethod = ({
346
352
  checkVesca(veSca?.unlockAt);
347
353
 
348
354
  if (veSca) {
349
- const sca = txBlock.redeemSca(veSca.keyId);
355
+ const sca = await txBlock.redeemSca(veSca.keyId);
350
356
  if (transferSca) {
351
357
  txBlock.transferObjects([sca], sender);
352
358
  return;
@@ -3,6 +3,7 @@ import { SupportPoolCoins } from 'src/types/constant/common';
3
3
  export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
4
4
  usdc: 'usdc',
5
5
  sbeth: 'ethereum',
6
+ sbusdt: 'tether',
6
7
  weth: 'ethereum',
7
8
  wbtc: 'bitcoin',
8
9
  wusdc: 'usdc',
@@ -15,6 +16,7 @@ export const COIN_GECKGO_IDS: Record<SupportPoolCoins, string> = {
15
16
  hasui: 'sui',
16
17
  vsui: 'sui',
17
18
  sca: 'scallop-2',
19
+ fdusd: 'first-digital-usd',
18
20
  deep: 'deepbook',
19
21
  fud: 'fud-the-pug',
20
22
  };
@@ -32,6 +32,7 @@ export const OLD_BORROW_INCENTIVE_PROTOCOL_ID =
32
32
  export const SUPPORT_POOLS = [
33
33
  'usdc', // native USDC
34
34
  'sbeth', // sui bridge ETH
35
+ 'sbusdt', // sui bridge USDT
35
36
  'weth',
36
37
  'wbtc',
37
38
  'wusdc',
@@ -46,11 +47,13 @@ export const SUPPORT_POOLS = [
46
47
  'sca',
47
48
  'fud',
48
49
  'deep',
50
+ 'fdusd',
49
51
  ] as const;
50
52
 
51
53
  export const SUPPORT_COLLATERALS = [
52
54
  'usdc', // native USDC
53
55
  'sbeth', // sui bridge ETH
56
+ 'sbusdt', // sui bridge USDT
54
57
  'weth',
55
58
  'wbtc',
56
59
  'wusdc',
@@ -63,6 +66,7 @@ export const SUPPORT_COLLATERALS = [
63
66
  'hasui',
64
67
  'vsui',
65
68
  'sca',
69
+ 'fdusd',
66
70
  ] as const;
67
71
 
68
72
  export const SUPPORT_SPOOLS = [
@@ -80,6 +84,7 @@ export const SUPPORT_SPOOLS = [
80
84
  export const SUPPORT_SCOIN = [
81
85
  'susdc',
82
86
  'ssbeth',
87
+ 'ssbusdt',
83
88
  'ssui',
84
89
  'swusdc',
85
90
  'swusdt',
@@ -93,9 +98,10 @@ export const SUPPORT_SCOIN = [
93
98
  'swbtc',
94
99
  'sdeep',
95
100
  'sfud',
101
+ 'sfdusd',
96
102
  ] as const;
97
103
 
98
- export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
104
+ export const SUPPORT_SUI_BRIDGE = ['sbeth', 'sbusdt'] as const;
99
105
  export const SUPPORT_WORMHOLE = [
100
106
  'wusdc',
101
107
  'wusdt',
@@ -4,6 +4,7 @@ import { IS_VE_SCA_TEST } from './common';
4
4
  export const coinDecimals: types.SupportCoinDecimals = {
5
5
  usdc: 6,
6
6
  sbeth: 8,
7
+ sbusdt: 6,
7
8
  weth: 8,
8
9
  wbtc: 8,
9
10
  wusdc: 6,
@@ -16,11 +17,13 @@ export const coinDecimals: types.SupportCoinDecimals = {
16
17
  hasui: 9,
17
18
  vsui: 9,
18
19
  sca: 9,
20
+ fdusd: 6,
19
21
  deep: 6,
20
22
  fud: 5,
21
23
  susdc: 6,
22
24
  sweth: 8,
23
25
  ssbeth: 8,
26
+ ssbusdt: 6,
24
27
  swbtc: 8,
25
28
  swusdc: 6,
26
29
  swusdt: 6,
@@ -32,6 +35,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
32
35
  shasui: 9,
33
36
  svsui: 9,
34
37
  ssca: 9,
38
+ sfdusd: 6,
35
39
  sdeep: 6,
36
40
  sfud: 5,
37
41
  };
@@ -39,6 +43,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
39
43
  export const assetCoins: types.AssetCoins = {
40
44
  usdc: 'usdc',
41
45
  sbeth: 'sbeth',
46
+ sbusdt: 'sbusdt',
42
47
  weth: 'weth',
43
48
  wbtc: 'wbtc',
44
49
  wusdc: 'wusdc',
@@ -51,6 +56,7 @@ export const assetCoins: types.AssetCoins = {
51
56
  hasui: 'hasui',
52
57
  vsui: 'vsui',
53
58
  sca: 'sca',
59
+ fdusd: 'fdusd',
54
60
  deep: 'deep',
55
61
  fud: 'fud',
56
62
  };
@@ -58,6 +64,7 @@ export const assetCoins: types.AssetCoins = {
58
64
  export const marketCoins: types.MarketCoins = {
59
65
  susdc: 'susdc',
60
66
  ssbeth: 'ssbeth',
67
+ ssbusdt: 'ssbusdt',
61
68
  sweth: 'sweth',
62
69
  swbtc: 'swbtc',
63
70
  swusdc: 'swusdc',
@@ -70,6 +77,7 @@ export const marketCoins: types.MarketCoins = {
70
77
  shasui: 'shasui',
71
78
  svsui: 'svsui',
72
79
  ssca: 'ssca',
80
+ sfdusd: 'sfdusd',
73
81
  sdeep: 'sdeep',
74
82
  sfud: 'sfud',
75
83
  };
@@ -77,6 +85,7 @@ export const marketCoins: types.MarketCoins = {
77
85
  export const sCoins: types.SCoins = {
78
86
  susdc: 'susdc',
79
87
  ssbeth: 'ssbeth',
88
+ ssbusdt: 'ssbusdt',
80
89
  sweth: 'sweth',
81
90
  swusdc: 'swusdc',
82
91
  swusdt: 'swusdt',
@@ -88,6 +97,7 @@ export const sCoins: types.SCoins = {
88
97
  ssca: 'ssca',
89
98
  swsol: 'swsol',
90
99
  swbtc: 'swbtc',
100
+ sfdusd: 'sfdusd',
91
101
  sfud: 'sfud',
92
102
  sdeep: 'sdeep',
93
103
  };
@@ -118,28 +128,35 @@ export const spoolRewardCoins: types.StakeRewardCoins = {
118
128
 
119
129
  export const suiBridgeCoins: types.SuiBridgeCoins = {
120
130
  sbeth: 'sbeth',
131
+ sbusdt: 'sbusdt',
121
132
  };
122
133
 
123
134
  export const coinIds: types.AssetCoinIds = {
124
- usdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
125
135
  sui: '0x0000000000000000000000000000000000000000000000000000000000000002',
126
- sbeth: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
136
+ cetus: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b',
137
+ sca: IS_VE_SCA_TEST
138
+ ? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
139
+ : '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
140
+ // Wormhole assets
127
141
  weth: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5',
128
142
  wbtc: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881',
129
- wusdc: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf',
130
- wusdt: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c',
131
143
  wapt: '0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37',
132
144
  wsol: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8',
133
- cetus: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b',
145
+ // Sui LST
134
146
  afsui: '0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc',
135
147
  hasui: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d',
136
148
  vsui: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55',
137
- sca: IS_VE_SCA_TEST
138
- ? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
139
- : '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
149
+ // stable coins
150
+ usdc: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7',
151
+ wusdc: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf',
152
+ wusdt: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c',
153
+ fdusd: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
140
154
  // isolated assets
141
155
  deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
142
156
  fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
157
+ // Sui bridge assets
158
+ sbeth: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
159
+ sbusdt: '0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068',
143
160
  };
144
161
 
145
162
  export const wormholeCoinIds: types.WormholeCoinIds = {
@@ -157,33 +174,42 @@ export const voloCoinIds: types.VoloCoinIds = {
157
174
 
158
175
  // PROD VERSION
159
176
  export const sCoinIds: types.SCoinIds = {
160
- susdc:
161
- '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
162
- ssbeth:
163
- '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
164
177
  ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
165
- swusdc:
166
- '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
167
- swusdt:
168
- '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
169
178
  ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
170
179
  scetus:
171
180
  '0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
181
+ // Wormhole assets
172
182
  sweth:
173
183
  '0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
184
+ swsol:
185
+ '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
186
+ swbtc:
187
+ '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
188
+ // Sui LST
174
189
  safsui:
175
190
  '0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI',
176
191
  shasui:
177
192
  '0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI',
178
193
  svsui:
179
194
  '0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI',
180
- swsol:
181
- '0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
182
- swbtc:
183
- '0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
195
+ // stable coins
196
+ susdc:
197
+ '0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
198
+ swusdc:
199
+ '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
200
+ swusdt:
201
+ '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
202
+ sfdusd:
203
+ '0x6711551c1e7652a270d9fbf0eee25d99594c157cde3cb5fbb49035eb59b1b001::scallop_fdusd::SCALLOP_FDUSD',
204
+ // isolated assets
184
205
  sdeep:
185
206
  '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
186
207
  sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
208
+ // Sui bridge assets
209
+ ssbeth:
210
+ '0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
211
+ ssbusdt:
212
+ '0xb1d7df34829d1513b73ba17cb7ad90c88d1e104bb65ab8f62f13e0cc103783d3::scallop_sb_usdt::SCALLOP_SB_USDT',
187
213
  } as const;
188
214
 
189
215
  export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
@@ -8,6 +8,5 @@ export * from './pyth';
8
8
  export * from './queryKeys';
9
9
  export * from './rpc';
10
10
  export * from './testAddress';
11
- export * from './tokenBucket';
12
11
  export * from './vesca';
13
12
  export * from './testAddress';