@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.8 → 2.3.0-lst-x-oracle-alpha.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.3.0-lst-x-oracle-alpha.8",
3
+ "version": "2.3.0-lst-x-oracle-alpha.9",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -146,6 +146,8 @@
146
146
  "scripts": {
147
147
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
148
148
  "build": "pnpm run clean && pnpm run build:tsup",
149
+ "build-sourcemap": "pnpm run clean && pnpm run build:sourcemap",
150
+ "build:sourcemap": "tsup ./src/index.ts --format esm,cjs --dts --sourcemap",
149
151
  "build:tsup": "tsup ./src/index.ts --format esm,cjs --dts --splitting --minify --treeshake",
150
152
  "watch": "pnpm run clean & pnpm run watch:types & pnpm run watch:tsup",
151
153
  "test": "pnpm test:typecheck && pnpm test:unit",
@@ -8,13 +8,6 @@ class UnsupportedOracleError extends Error {
8
8
  }
9
9
  }
10
10
 
11
- class UnsupportedLstUpdateError extends Error {
12
- constructor(lst: string) {
13
- super(`Unsupported LST update for: ${lst}`);
14
- this.name = 'UnsupportedLstUpdateError';
15
- }
16
- }
17
-
18
11
  class UnsupportedLstOracleError extends Error {
19
12
  constructor(lst: string, oracle: string) {
20
13
  super(`Unsupported LST oracle update for: ${lst} with oracle: ${oracle}`);
@@ -22,8 +15,4 @@ class UnsupportedLstOracleError extends Error {
22
15
  }
23
16
  }
24
17
 
25
- export {
26
- UnsupportedOracleError,
27
- UnsupportedLstUpdateError,
28
- UnsupportedLstOracleError,
29
- };
18
+ export { UnsupportedOracleError, UnsupportedLstOracleError };
@@ -3,27 +3,29 @@ import { ScallopUtils } from 'src/models';
3
3
  import {
4
4
  AddressStringPath,
5
5
  BasePackage,
6
- OracleLst,
7
- OracleLstConfig,
6
+ PythOracleLstConfig,
8
7
  SupportOracleLst,
9
8
  } from 'src/types/address';
10
9
  import { UnsupportedOracleError } from './error';
11
10
  import { SupportedOracleSuiLst, SupportOracleType } from 'src/types/constant';
11
+ import { SUPPORT_SUI_LST } from 'src/constants';
12
12
 
13
13
  export type XOraclePackages = {
14
14
  xOraclePackageId: string;
15
15
  xOracleId: TransactionArgument | string;
16
16
  };
17
17
 
18
- type LstPackages<
19
- T extends SupportOracleLst,
20
- U extends SupportedOracleSuiLst = SupportedOracleSuiLst,
21
- > = {
22
- [K in U]: OracleLst<T, U>[K] & BasePackage;
23
- };
18
+ type RecordValueType<T> = T extends Record<any, infer V> ? V : never;
19
+
20
+ export type PythLstPackages<T extends SupportedOracleSuiLst> = RecordValueType<
21
+ PythOracleLstConfig<T>
22
+ > &
23
+ BasePackage;
24
24
 
25
25
  type MaybeWithLstPackage<T, U> = T extends SupportOracleLst
26
- ? U & { lst: LstPackages<T> }
26
+ ? T extends 'pyth'
27
+ ? U & { lst: PythLstPackages<SupportedOracleSuiLst> }
28
+ : never
27
29
  : U;
28
30
 
29
31
  type PythStaticPackages = {
@@ -62,18 +64,24 @@ export type SupraPackages = {
62
64
  supraRegistryId: TransactionArgument | string;
63
65
  };
64
66
 
65
- export type OraclePackages<T extends SupportOracleType> = T extends 'pyth'
66
- ? PythPackages
67
- : T extends 'switchboard'
68
- ? SwitchboardPackages
69
- : T extends 'supra'
70
- ? SupraPackages
71
- : never;
72
-
73
- type getLstPackagesReturnType<T> = T extends SupportOracleLst
74
- ? LstPackages<T, SupportedOracleSuiLst>
75
- : never;
67
+ export type OraclePackages<T extends SupportOracleType = SupportOracleType> =
68
+ T extends 'pyth'
69
+ ? PythPackages
70
+ : T extends 'switchboard'
71
+ ? SwitchboardPackages
72
+ : T extends 'supra'
73
+ ? SupraPackages
74
+ : never;
75
+
76
+ type getLstPackagesReturnType<
77
+ T extends SupportOracleType,
78
+ U extends SupportedOracleSuiLst = SupportedOracleSuiLst,
79
+ > = T extends 'pyth' ? PythLstPackages<U> : never;
76
80
 
81
+ const PYTH_LST_PATHS: Record<SupportedOracleSuiLst, AddressStringPath> = {
82
+ afsui: 'core.oracles.pyth.lst.afsui',
83
+ hasui: 'core.oracles.pyth.lst.hasui',
84
+ };
77
85
  export interface IOraclePackageRegistry<
78
86
  T extends SupportOracleType = SupportOracleType,
79
87
  > {
@@ -160,10 +168,10 @@ class PythPackageRegistry
160
168
  }
161
169
 
162
170
  private getLstOracleConfigPackages(coinName: SupportedOracleSuiLst) {
163
- const oracleLstConfig = this.xOraclePackageRegistry.getAddressPath(
164
- `core.oracles.pyth.lst.${coinName}`
165
- ) as OracleLstConfig<typeof coinName>[typeof coinName];
166
- return oracleLstConfig;
171
+ const path = PYTH_LST_PATHS[coinName];
172
+ if (path) {
173
+ return this.xOraclePackageRegistry.getAddressPath(path);
174
+ }
167
175
  }
168
176
 
169
177
  getLstPackages(coinName: SupportedOracleSuiLst) {
@@ -172,22 +180,28 @@ class PythPackageRegistry
172
180
  ) as BasePackage;
173
181
 
174
182
  // get the oracle config for the coin
175
- const oracleLstConfig = this.getLstOracleConfigPackages(coinName);
183
+ const oracleLstConfig = this.getLstOracleConfigPackages(coinName) ?? {};
184
+
176
185
  return {
177
- [coinName]: {
178
- ...lstPackages,
179
- ...oracleLstConfig,
180
- },
186
+ ...lstPackages,
187
+ ...oracleLstConfig,
181
188
  };
182
189
  }
183
190
 
184
- getPackages(coinName: string): OraclePackages<'pyth'> {
191
+ private resolvePythFeedForSuiLst(coinName: string) {
192
+ if (SUPPORT_SUI_LST.includes(coinName as any)) {
193
+ return 'sui';
194
+ }
195
+ return coinName;
196
+ }
197
+
198
+ getPackages(coinName: string) {
185
199
  const lstPackages = this.getLstPackages(coinName as SupportedOracleSuiLst);
186
200
 
187
201
  return {
188
202
  ...this.getStaticPackages,
189
203
  pythFeedObjectId: this.xOraclePackageRegistry.getAddressPath(
190
- `core.coins.${coinName}.oracle.pyth.feedObject`
204
+ `core.coins.${this.resolvePythFeedForSuiLst(coinName)}.oracle.pyth.feedObject`
191
205
  ),
192
206
  lst: lstPackages,
193
207
  };
@@ -218,7 +232,7 @@ class SupraPackageRegistry extends BasePackageRegistry {
218
232
  supraHolderId: this.xOraclePackageRegistry.getAddressPath(
219
233
  'core.oracles.supra.holder'
220
234
  ),
221
- } as OraclePackages<typeof this.oracleName>;
235
+ };
222
236
  }
223
237
  }
224
238
 
@@ -3,12 +3,11 @@ import {
3
3
  SuiTxBlock,
4
4
  TransactionArgument,
5
5
  } from '@scallop-io/sui-kit';
6
- import { IOraclePackageRegistry } from './oraclePackageRegistry';
7
6
  import {
8
- SupportedOracleSuiLst,
9
- SupportOracleType,
10
- xOracleRuleType,
11
- } from 'src/types/constant';
7
+ IOraclePackageRegistry,
8
+ PythLstPackages,
9
+ } from './oraclePackageRegistry';
10
+ import { SupportOracleType, xOracleRuleType } from 'src/types/constant';
12
11
  import { UnsupportedLstOracleError } from './error';
13
12
 
14
13
  export interface IXOracleUpdateStrategy<
@@ -83,9 +82,10 @@ export class PythDefaultUpdateStrategy extends BaseUpdateStrategy<'pyth'> {
83
82
  );
84
83
  }
85
84
  }
86
- export class PythSuiLstUpdateStrategy extends BaseUpdateStrategy<
85
+
86
+ export class PythAfSuiUpdateStrategy extends BaseUpdateStrategy<
87
87
  'pyth',
88
- SupportedOracleSuiLst
88
+ 'afsui'
89
89
  > {
90
90
  readonly oracleType = 'pyth';
91
91
  constructor(protected readonly registry: IOraclePackageRegistry<'pyth'>) {
@@ -95,15 +95,18 @@ export class PythSuiLstUpdateStrategy extends BaseUpdateStrategy<
95
95
  updatePrice(
96
96
  tx: SuiTxBlock,
97
97
  request: TransactionArgument,
98
- coinName: SupportedOracleSuiLst,
98
+ coinName: 'afsui',
99
99
  rule: xOracleRuleType
100
100
  ): void {
101
101
  const { lst, pythFeedObjectId, pythStateId } =
102
102
  this.registry.getPackages(coinName);
103
- if (!lst[coinName]) {
103
+ if (!lst) {
104
104
  throw new UnsupportedLstOracleError(coinName, this.oracleType);
105
105
  }
106
- const { id, configId, stakedSuiVaultId, safeId } = lst[coinName];
106
+ const { id, configId, stakedSuiVaultId, safeId } = lst as PythLstPackages<
107
+ typeof coinName
108
+ >;
109
+
107
110
  tx.moveCall(`${id}::rule::set_price_as_${rule}`, [
108
111
  request,
109
112
  pythStateId,
@@ -116,6 +119,39 @@ export class PythSuiLstUpdateStrategy extends BaseUpdateStrategy<
116
119
  }
117
120
  }
118
121
 
122
+ export class PythHaSuiUpdateStrategy extends BaseUpdateStrategy<
123
+ 'pyth',
124
+ 'hasui'
125
+ > {
126
+ readonly oracleType = 'pyth';
127
+ constructor(protected readonly registry: IOraclePackageRegistry<'pyth'>) {
128
+ super(registry);
129
+ }
130
+
131
+ updatePrice(
132
+ tx: SuiTxBlock,
133
+ request: TransactionArgument,
134
+ coinName: 'hasui',
135
+ rule: xOracleRuleType
136
+ ): void {
137
+ const { lst, pythFeedObjectId, pythStateId } =
138
+ this.registry.getPackages(coinName);
139
+ if (!lst) {
140
+ throw new UnsupportedLstOracleError(coinName, this.oracleType);
141
+ }
142
+ const { id, staking, configId } = lst as PythLstPackages<typeof coinName>;
143
+
144
+ tx.moveCall(`${id}::rule::set_price_as_${rule}`, [
145
+ request,
146
+ pythStateId,
147
+ pythFeedObjectId,
148
+ configId,
149
+ staking,
150
+ tx.sharedObjectRef(this.clockObject),
151
+ ]);
152
+ }
153
+ }
154
+
119
155
  export class SupraDefaultUpdateStrategy extends BaseUpdateStrategy<'supra'> {
120
156
  readonly oracleType = 'supra';
121
157
  constructor(protected readonly registry: IOraclePackageRegistry<'supra'>) {
@@ -4,12 +4,13 @@ import { SUPPORT_SUI_LST } from 'src/constants/xoracle';
4
4
  import { IOraclePackageRegistry } from './oraclePackageRegistry';
5
5
  import {
6
6
  IXOracleUpdateStrategy,
7
+ PythAfSuiUpdateStrategy,
7
8
  PythDefaultUpdateStrategy,
8
- PythSuiLstUpdateStrategy,
9
+ PythHaSuiUpdateStrategy,
9
10
  SupraDefaultUpdateStrategy,
10
11
  SwitchboardDefaultUpdateStrategy,
11
12
  } from './xOracleUpdateStrategy';
12
- import { UnsupportedLstOracleError } from './error';
13
+ import { UnsupportedOracleError } from './error';
13
14
 
14
15
  export interface IXOracleUpdater<
15
16
  T extends SupportOracleType = SupportOracleType,
@@ -53,7 +54,8 @@ class PythXOracleUpdater extends BaseXOracleUpdater<'pyth'> {
53
54
  constructor(tx: SuiTxBlock, registry: IOraclePackageRegistry<'pyth'>) {
54
55
  super(tx, registry, {
55
56
  default: new PythDefaultUpdateStrategy(registry),
56
- sui_lst: new PythSuiLstUpdateStrategy(registry),
57
+ afsui: new PythAfSuiUpdateStrategy(registry),
58
+ hasui: new PythHaSuiUpdateStrategy(registry),
57
59
  });
58
60
  }
59
61
 
@@ -61,23 +63,8 @@ class PythXOracleUpdater extends BaseXOracleUpdater<'pyth'> {
61
63
  coinName: string
62
64
  ): IXOracleUpdateStrategy<typeof this.oracleName> {
63
65
  // decide which key to look up in this.strategies
64
- let key: string;
65
-
66
- if (this.SUPPORT_SUI_LST_SET.has(coinName)) {
67
- key = 'sui_lst';
68
- }
69
- // else if (this.WALRUS_LST_SET.has(coinName)) {
70
- // key = 'walrus_lst';
71
- // }
72
- else {
73
- key = 'default';
74
- }
75
-
76
- const strat = this.strategies.get(key);
77
- if (!strat) {
78
- // guard if you forgot to register default or list strategies
79
- throw new UnsupportedLstOracleError(coinName, this.oracleName);
80
- }
66
+ const strat =
67
+ this.strategies.get(coinName) ?? this.strategies.get('default');
81
68
 
82
69
  return strat as IXOracleUpdateStrategy<typeof this.oracleName>;
83
70
  }
@@ -107,7 +94,10 @@ class SupraXOracleUpdater extends BaseXOracleUpdater<'supra'> {
107
94
  request: TransactionArgument
108
95
  ): void {
109
96
  const stragtegy = this.strategies.get('default');
110
- stragtegy?.updatePrice(this.tx, request, coinName, rule);
97
+ if (!stragtegy) {
98
+ throw new UnsupportedOracleError(this.oracleName);
99
+ }
100
+ stragtegy.updatePrice(this.tx, request, coinName, rule);
111
101
  }
112
102
  }
113
103
 
@@ -126,7 +116,10 @@ class SwitchboardXOracleUpdater extends BaseXOracleUpdater<'switchboard'> {
126
116
  request: TransactionArgument
127
117
  ): void {
128
118
  const stragtegy = this.strategies.get('default');
129
- stragtegy?.updatePrice(this.tx, request, coinName, rule);
119
+ if (!stragtegy) {
120
+ throw new UnsupportedOracleError(this.oracleName);
121
+ }
122
+ stragtegy.updatePrice(this.tx, request, coinName, rule);
130
123
  }
131
124
  }
132
125
 
@@ -36,10 +36,6 @@ const generateSCoinNormalMethod: GenerateSCoinNormalMethod = ({
36
36
  const sCoinType = builder.utils.parseSCoinType(sCoinName);
37
37
  if (!sCoinType) throw new Error(`Invalid sCoin name: ${sCoinName}`);
38
38
 
39
- console.log({
40
- sCoinName,
41
- treasury: builder.utils.getSCoinTreasury(sCoinName),
42
- });
43
39
  return builder.moveCall(
44
40
  txBlock,
45
41
  `${sCoinPkgIds.pkgId}::s_coin_converter::burn_s_coin`,
@@ -75,6 +75,25 @@ export const TEST_ADDRESSES: AddressesInterface = {
75
75
  },
76
76
  },
77
77
  },
78
+ hasui: {
79
+ id: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d',
80
+ metaData:
81
+ '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
82
+ treasury: '',
83
+ coinType:
84
+ '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
85
+ symbol: 'haSUI',
86
+ decimals: 9,
87
+ oracle: {
88
+ supra: '',
89
+ switchboard: '',
90
+ pyth: {
91
+ feed: '6120ffcf96395c70aa77e72dcb900bf9d40dccab228efca59a17b90ce423d5e8',
92
+ feedObject:
93
+ '0x4c1d831576b60fec657e0c310943eff8c1f28197c552e57d1fefdc55edddb263',
94
+ },
95
+ },
96
+ },
78
97
  sca: {
79
98
  id: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
80
99
  metaData:
@@ -179,6 +198,12 @@ export const TEST_ADDRESSES: AddressesInterface = {
179
198
  configId:
180
199
  '0x67103edaadcd38b76f5df76d99adcad989260a5f16bfd411a67efbf858b2f7a2',
181
200
  },
201
+ hasui: {
202
+ configId:
203
+ '0x5d14712cfd47fcb9e414c15a14273f9d2188dbb918239db75ee2769b5136f821',
204
+ staking:
205
+ '0x47b224762220393057ebf4f70501b6e657c3e56684737568439a04f80849b2ca',
206
+ },
182
207
  },
183
208
  },
184
209
  },
@@ -234,6 +259,11 @@ export const TEST_ADDRESSES: AddressesInterface = {
234
259
  object:
235
260
  '0xd45b20f4bbc7ab4b2b3874a4fa38aa440505d8010bba052df914892537e6b418',
236
261
  },
262
+ hasui: {
263
+ id: '0xac62b68b386dab503a6ef64c97e55dffac34c8f908373025751a111b72b767dc',
264
+ object:
265
+ '0xac62b68b386dab503a6ef64c97e55dffac34c8f908373025751a111b72b767dc',
266
+ },
237
267
  },
238
268
  },
239
269
  switchboard: {
@@ -418,6 +448,15 @@ export const TEST_ADDRESSES: AddressesInterface = {
418
448
  '0x42179b69f82ea26e3763345ee0fb1cea8b1bd355168b3241ceb727ec82bb0688',
419
449
  symbol: 'safSUI',
420
450
  },
451
+ shasui: {
452
+ coinType:
453
+ '0xbd01338d893255e7e53a41b1c021438d31f348c074809027fcad259e348529b5::scallop_ha_sui::SCALLOP_HA_SUI',
454
+ treasury:
455
+ '0xb987e7a4cd3c16247f422599882093375201487c46ece80f980a30227a385e75',
456
+ metaData:
457
+ '0x94a1bb23c6272d01f03bb5dec2a1915a41f154d14548157a099d5630197ce30d',
458
+ symbol: 'shaSUI',
459
+ },
421
460
  susdc: {
422
461
  coinType:
423
462
  '0x55ed015f9f006c0c96ad36ebe3b3570d088e8498f52defea48e5634c110e485c::scallop_usdc::SCALLOP_USDC',
@@ -464,7 +503,7 @@ export const TEST_WHITELIST = {
464
503
  // 'wsol',
465
504
  // 'cetus',
466
505
  'afsui',
467
- // 'hasui',
506
+ 'hasui',
468
507
  // 'vsui',
469
508
  'sca',
470
509
  'fud',
@@ -490,7 +529,7 @@ export const TEST_WHITELIST = {
490
529
  // 'wsol',
491
530
  // 'cetus',
492
531
  'afsui',
493
- // 'hasui',
532
+ 'hasui',
494
533
  // 'vsui',
495
534
  'sca',
496
535
  // 'fdusd',
@@ -512,7 +551,7 @@ export const TEST_WHITELIST = {
512
551
  // 'wsol',
513
552
  // 'cetus',
514
553
  'afsui',
515
- // 'hasui',
554
+ 'hasui',
516
555
  // 'vsui',
517
556
  'sca',
518
557
  'fud',
@@ -558,7 +597,7 @@ export const TEST_WHITELIST = {
558
597
  // 'swusdc',
559
598
  // 'swusdt',
560
599
  'safsui',
561
- // 'shasui',
600
+ 'shasui',
562
601
  // 'svsui',
563
602
  // 'sweth',
564
603
  'ssca',
@@ -837,4 +876,49 @@ export const TEST_POOL_ADDRESSES = {
837
876
  flashloanFeeObject:
838
877
  '0xac87fde83d434554ec300c1334c9a622aa5b59e82a04334dc99e1cc1f75d4eae',
839
878
  },
879
+ hasui: {
880
+ coinName: 'hasui',
881
+ symbol: 'haSUI',
882
+ lendingPoolAddress:
883
+ '0x7a7ca5e75f453de923284a54764819f27486bd7f6fd45147116bfc239ba8fb4d',
884
+ collateralPoolAddress:
885
+ '0xe1ad830b29eab6b72f11d7016ff87db4f3996f68a81ea621ec37f0b7df9a7ce5',
886
+ borrowDynamic:
887
+ '0x3545546a7fa2100bca3bab8739c11890a6ccce2cb2584c204a064e35005314b5',
888
+ interestModel:
889
+ '0xa280d2976e3475bebebb65e433f1998867916d1b51139bf90312c4434e8d9875',
890
+ riskModel:
891
+ '0x5b35d4a369961ff5de98ca1830d92b66d91b3651421ba9202e95329dc80493d6',
892
+ borrowFeeKey:
893
+ '0xef885c382d461c4fb14d1f3b3758c380c78a1a4b2a3d2fafe6e8649a60fdd7ab',
894
+ supplyLimitKey:
895
+ '0xc7385b1703693cbbc9c97227fe3fd5c91d7afda00e0da69d942c3260d78e45e0',
896
+ borrowLimitKey:
897
+ '0x65333e606eead786a999c8267bc9886b0fdbc298a8a8635a48a9c9b8838d9395',
898
+ isolatedAssetKey: '',
899
+ isIsolated: false,
900
+ spool: '0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa',
901
+ spoolReward:
902
+ '0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
903
+ sCoinType:
904
+ '0xbd01338d893255e7e53a41b1c021438d31f348c074809027fcad259e348529b5::scallop_ha_sui::SCALLOP_HA_SUI',
905
+ sCoinTreasury:
906
+ '0xb987e7a4cd3c16247f422599882093375201487c46ece80f980a30227a385e75',
907
+ sCoinMetadataId:
908
+ '0x94a1bb23c6272d01f03bb5dec2a1915a41f154d14548157a099d5630197ce30d',
909
+ sCoinSymbol: 'shaSUI',
910
+ sCoinName: 'shasui',
911
+ coinMetadataId:
912
+ '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
913
+ coinType:
914
+ '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI',
915
+ spoolName: 'shasui',
916
+ decimals: 9,
917
+ pythFeed:
918
+ '6120ffcf96395c70aa77e72dcb900bf9d40dccab228efca59a17b90ce423d5e8',
919
+ pythFeedObjectId:
920
+ '0x4c1d831576b60fec657e0c310943eff8c1f28197c552e57d1fefdc55edddb263',
921
+ flashloanFeeObject:
922
+ '0xb9f505d532de1d6c9f3a8522a2d16f2958b75c0ed939d4f80b96f584a2a8ed5e',
923
+ },
840
924
  };
@@ -1,7 +1,7 @@
1
1
  export const SUPPORT_ORACLES = ['supra', 'switchboard', 'pyth'] as const;
2
2
  export const X_ORACLE_RULES = ['primary', 'secondary'] as const;
3
3
  export const SUPPORT_ORACLE_LST = ['pyth'] as const;
4
- export const SUPPORT_SUI_LST = ['afsui'] as const;
4
+ export const SUPPORT_SUI_LST = ['afsui', 'hasui'] as const;
5
5
 
6
6
  export const X_ORACLE_LIST: Record<
7
7
  string,
@@ -249,6 +249,10 @@ const EMPTY_ADDRESSES: AddressesInterface = {
249
249
  stakedSuiVaultId: '',
250
250
  configId: '',
251
251
  },
252
+ hasui: {
253
+ configId: '',
254
+ staking: '',
255
+ },
252
256
  },
253
257
  },
254
258
  },
@@ -293,6 +297,10 @@ const EMPTY_ADDRESSES: AddressesInterface = {
293
297
  id: '',
294
298
  object: '',
295
299
  },
300
+ hasui: {
301
+ id: '',
302
+ object: '',
303
+ },
296
304
  },
297
305
  },
298
306
  switchboard: {
@@ -28,21 +28,34 @@ type Packages<
28
28
 
29
29
  export type SupportOracleLst = (typeof SUPPORT_ORACLE_LST)[number];
30
30
 
31
- export type OracleLstConfig<T extends SupportedOracleSuiLst> = T extends 'afsui'
32
- ? Record<
33
- T,
31
+ type PythOracleLstConfigItem<T extends SupportedOracleSuiLst, U> = Record<
32
+ T,
33
+ { configId: string } & U
34
+ >;
35
+
36
+ export type PythOracleLstConfig<
37
+ T extends SupportedOracleSuiLst = SupportedOracleSuiLst,
38
+ > = T extends 'afsui'
39
+ ? PythOracleLstConfigItem<
40
+ 'afsui',
34
41
  {
35
42
  stakedSuiVaultId: string;
36
43
  safeId: string;
37
44
  configId: string;
38
45
  }
39
46
  >
40
- : never;
47
+ : T extends 'hasui'
48
+ ? PythOracleLstConfigItem<
49
+ 'hasui',
50
+ {
51
+ staking: string;
52
+ }
53
+ >
54
+ : never;
41
55
 
42
- export type OracleLst<
43
- T extends SupportOracleLst,
44
- U extends SupportedOracleSuiLst = SupportedOracleSuiLst,
45
- > = T extends 'pyth' ? OracleLstConfig<U> : undefined;
56
+ export type OracleLst<T extends SupportOracleLst> = T extends 'pyth'
57
+ ? PythOracleLstConfig
58
+ : never;
46
59
 
47
60
  type MaybeWithOracleLst<T, U> = T extends SupportOracleLst
48
61
  ? U & {