@scallop-io/sui-scallop-sdk 2.2.3-pyth-sponsored-transaction-alpha.1 → 2.3.0-lst-x-oracle-alpha.2

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 (74) hide show
  1. package/dist/address-CW2IpaLn.d.ts +165 -0
  2. package/dist/chunk-E3URAUAC.js +25 -0
  3. package/dist/chunk-YA77R5GT.mjs +5 -0
  4. package/dist/constants/index.d.mts +262 -0
  5. package/dist/constants/index.d.ts +262 -0
  6. package/dist/constants/index.js +86 -0
  7. package/dist/constants/index.mjs +5 -0
  8. package/dist/index.d.mts +11 -3242
  9. package/dist/index.d.ts +11 -3242
  10. package/dist/index.js +0 -47
  11. package/dist/index.mjs +0 -14
  12. package/dist/models/index.d.mts +393 -0
  13. package/dist/models/index.d.ts +393 -0
  14. package/dist/models/index.js +34 -0
  15. package/dist/models/index.mjs +16 -0
  16. package/dist/queryKeys-AaZqDYle.d.ts +43 -0
  17. package/dist/scallopUtils-BZLZd2z8.d.ts +2404 -0
  18. package/dist/types/index.d.mts +9 -0
  19. package/dist/types/index.d.ts +9 -0
  20. package/dist/types/index.js +2 -0
  21. package/dist/types/index.mjs +1 -0
  22. package/package.json +31 -4
  23. package/src/builders/borrowIncentiveBuilder.ts +2 -2
  24. package/src/builders/coreBuilder.ts +5 -14
  25. package/src/builders/index.ts +2 -2
  26. package/src/builders/oracles/error.ts +29 -0
  27. package/src/builders/oracles/index.ts +114 -365
  28. package/src/builders/oracles/oraclePackageRegistry.ts +323 -0
  29. package/src/builders/oracles/priceFeedUpdater.ts +112 -0
  30. package/src/builders/oracles/priceUpdateRequester.ts +50 -0
  31. package/src/builders/oracles/xOracleUpdateStrategy.ts +178 -0
  32. package/src/builders/oracles/xOracleUpdater.ts +160 -0
  33. package/src/builders/vescaBuilder.ts +2 -2
  34. package/src/constants/api.ts +2 -0
  35. package/src/constants/common.ts +0 -3
  36. package/src/constants/index.ts +2 -1
  37. package/src/constants/package.ts +14 -0
  38. package/src/constants/testAddress.ts +190 -105
  39. package/src/constants/xoracle.ts +8 -2
  40. package/src/index.ts +2 -12
  41. package/src/models/index.ts +2 -1
  42. package/src/models/interface.ts +6 -6
  43. package/src/models/scallopAddress.ts +24 -4
  44. package/src/models/scallopBuilder.ts +4 -4
  45. package/src/models/scallopClient.ts +1 -1
  46. package/src/models/scallopConstants.ts +2 -2
  47. package/src/models/scallopIndexer.ts +3 -2
  48. package/src/models/scallopQuery.ts +52 -36
  49. package/src/models/scallopQueryClient.ts +1 -1
  50. package/src/models/scallopSuiKit.ts +1 -1
  51. package/src/models/scallopUtils.ts +5 -8
  52. package/src/queries/borrowIncentiveQuery.ts +2 -3
  53. package/src/queries/coreQuery.ts +2 -3
  54. package/src/queries/index.ts +4 -3
  55. package/src/queries/loyaltyProgramQuery.ts +1 -1
  56. package/src/queries/portfolioQuery.ts +13 -13
  57. package/src/queries/sCoinQuery.ts +2 -2
  58. package/src/queries/spoolQuery.ts +8 -8
  59. package/src/queries/vescaQuery.ts +2 -2
  60. package/src/queries/xOracleQuery.ts +20 -3
  61. package/src/types/address.ts +85 -47
  62. package/src/types/builder/core.ts +2 -4
  63. package/src/types/constant/index.ts +2 -1
  64. package/src/types/constant/package.ts +3 -0
  65. package/src/types/constant/xOracle.ts +10 -7
  66. package/src/types/query/index.ts +0 -1
  67. package/src/utils/builder.ts +1 -1
  68. package/src/utils/index.ts +2 -2
  69. package/src/utils/query.ts +6 -6
  70. package/src/utils/util.ts +1 -1
  71. package/src/builders/oracles/pyth.ts +0 -52
  72. package/src/queries/ownerQuery.ts +0 -32
  73. package/src/types/constant/enum.ts +0 -64
  74. package/src/types/query/sCoin.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import { normalizeStructTag } from '@mysten/sui/utils';
3
3
  import type { ScallopUtils } from '../models';
4
- import type {
4
+ import {
5
5
  OriginMarketPoolData,
6
6
  ParsedMarketPoolData,
7
7
  CalculatedMarketPoolData,
@@ -14,16 +14,16 @@ import type {
14
14
  OriginSpoolRewardPoolData,
15
15
  ParsedSpoolRewardPoolData,
16
16
  CalculatedSpoolRewardPoolData,
17
- OriginBorrowIncentivePoolData,
18
- ParsedBorrowIncentivePoolData,
19
- OriginBorrowIncentiveAccountData,
20
- ParsedBorrowIncentiveAccountData,
21
17
  OriginBorrowIncentivePoolPointData,
22
18
  ParsedBorrowIncentivePoolPointData,
19
+ OriginBorrowIncentivePoolData,
20
+ ParsedBorrowIncentivePoolData,
23
21
  CalculatedBorrowIncentivePoolPointData,
24
22
  OriginBorrowIncentiveAccountPoolData,
25
23
  ParsedBorrowIncentiveAccountPoolData,
26
- } from '../types';
24
+ OriginBorrowIncentiveAccountData,
25
+ ParsedBorrowIncentiveAccountData,
26
+ } from 'src/types/query';
27
27
 
28
28
  /**
29
29
  * Parse origin market pool data to a more readable format.
package/src/utils/util.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MAX_LOCK_DURATION } from 'src/constants';
1
+ import { MAX_LOCK_DURATION } from 'src/constants/vesca';
2
2
  // import { ScallopConstants } from 'src/models/scallopConstants';
3
3
 
4
4
  /**
@@ -1,52 +0,0 @@
1
- import {
2
- SuiPriceServiceConnection,
3
- SuiPythClient,
4
- } from '@pythnetwork/pyth-sui-js';
5
- import { ScallopBuilder } from 'src/models';
6
- import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
7
-
8
- export const updatePythPriceFeeds = async (
9
- builder: ScallopBuilder,
10
- assetCoinNames: string[],
11
- txBlock: SuiKitTxBlock,
12
- isSponsoredTx: boolean = false
13
- ) => {
14
- const pythClient = new SuiPythClient(
15
- builder.suiKit.client,
16
- builder.address.get('core.oracles.pyth.state'),
17
- builder.address.get('core.oracles.pyth.wormholeState'),
18
- {
19
- defaultPackageId:
20
- '0xa6f9bec2f9748656b6af8aafb5d7bc1a0d5faf25ac9645fc7f447822cd509325',
21
- gasStationId:
22
- '0xa8b8dcc9880166edb57b53e05f8df7364d31b5d9b7d107fd27f0b69cf338b687',
23
- }
24
- );
25
- const priceIds = assetCoinNames.map((assetCoinName) =>
26
- builder.address.get(`core.coins.${assetCoinName}.oracle.pyth.feed`)
27
- );
28
-
29
- // iterate through the endpoints
30
- const endpoints = builder.utils.pythEndpoints ?? [
31
- ...builder.constants.whitelist.pythEndpoints,
32
- ];
33
- for (const endpoint of endpoints) {
34
- try {
35
- const pythConnection = new SuiPriceServiceConnection(endpoint);
36
- const priceUpdateData =
37
- await pythConnection.getPriceFeedsUpdateData(priceIds);
38
- await pythClient.updatePriceFeeds(
39
- txBlock.txBlock,
40
- priceUpdateData,
41
- priceIds,
42
- isSponsoredTx
43
- );
44
-
45
- break;
46
- } catch (e) {
47
- console.warn(
48
- `Failed to update price feeds with endpoint ${endpoint}: ${e}`
49
- );
50
- }
51
- }
52
- };
@@ -1,32 +0,0 @@
1
- // import { ObjectOwner, SuiObjectData } from '@mysten/sui/client';
2
-
3
- // const parseOwnerAddress = (owner: ObjectOwner | null | undefined): string => {
4
- // const notSupportedOwner =
5
- // !owner ||
6
- // typeof owner === 'string' ||
7
- // (typeof owner === 'object' &&
8
- // ('Shared' in owner || 'ConsensusV2' in owner));
9
- // if (notSupportedOwner)
10
- // throw new Error('Owner not supported (ConsensusV2 or Shared or Immutable)');
11
-
12
- // if ('AddressOwner' in owner) {
13
- // return owner.AddressOwner;
14
- // } else {
15
- // return owner.ObjectOwner;
16
- // }
17
- // };
18
-
19
- // export const getObjectOwner = async (
20
- // cache: ScallopCache,
21
- // object: string | SuiObjectData
22
- // ) => {
23
- // if (typeof object === 'object') {
24
- // return parseOwnerAddress(object.owner);
25
- // }
26
-
27
- // const objResponse = await cache.queryGetObject(object, {
28
- // showOwner: true,
29
- // });
30
-
31
- // return parseOwnerAddress(objResponse.data?.owner);
32
- // };
@@ -1,64 +0,0 @@
1
- export type Coins = {
2
- [K in string]: K;
3
- };
4
-
5
- export type AssetCoins = {
6
- [K in string]: K;
7
- };
8
-
9
- export type MarketCoins = {
10
- [K in string]: K;
11
- };
12
-
13
- export type SCoins = {
14
- [K in string]: K;
15
- };
16
-
17
- export type StakeMarketCoins = {
18
- [K in string]: K;
19
- };
20
-
21
- export type StakeRewardCoins = {
22
- [key in string]: string;
23
- };
24
-
25
- export type SuiBridgeCoins = {
26
- [K in string]: K;
27
- };
28
-
29
- export type BorrowIncentiveRewardCoins = {
30
- [key in string]: string[];
31
- };
32
-
33
- export type AssetCoinIds = {
34
- [key in string]: string;
35
- };
36
-
37
- export type SCoinIds = {
38
- [key in string]: string;
39
- };
40
-
41
- export type SCoinTreasuryCaps = {
42
- [key in string]: string;
43
- };
44
-
45
- export type SCoinConverterTreasury = {
46
- [key in string]: string;
47
- };
48
-
49
- type PickFromUnion<T, K extends string> = K extends T ? K : never;
50
-
51
- export type WormholeCoinIds = {
52
- [key in PickFromUnion<
53
- string,
54
- 'weth' | 'wbtc' | 'wusdc' | 'wusdt' | 'wapt' | 'wsol'
55
- >]: string;
56
- };
57
-
58
- export type VoloCoinIds = {
59
- [key in PickFromUnion<string, 'vsui'>]: string;
60
- };
61
-
62
- export type SuiBridgedCoinPackageIds = {
63
- [key in string]: string;
64
- };
@@ -1 +0,0 @@
1
- export type sCoinBalance = number;