@scallop-io/sui-scallop-sdk 2.3.0-lst-x-oracle-alpha.3 → 2.3.0-lst-x-oracle-alpha.5
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/dist/index.d.mts +2838 -11
- package/dist/index.d.ts +2838 -11
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -1
- package/package.json +6 -35
- package/src/builders/borrowIncentiveBuilder.ts +1 -1
- package/src/builders/coreBuilder.ts +1 -1
- package/src/builders/loyaltyProgramBuilder.ts +1 -1
- package/src/builders/referralBuilder.ts +1 -1
- package/src/builders/sCoinBuilder.ts +5 -1
- package/src/builders/spoolBuilder.ts +1 -1
- package/src/builders/vescaBuilder.ts +1 -1
- package/src/constants/index.ts +0 -1
- package/src/constants/testAddress.ts +10 -10
- package/src/index.ts +12 -3
- package/src/models/scallop.ts +1 -1
- package/src/models/scallopAddress.ts +1 -1
- package/src/models/scallopBuilder.ts +1 -1
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopConstants.ts +1 -1
- package/src/models/scallopQuery.ts +2 -2
- package/src/models/scallopUtils.ts +2 -2
- package/src/models/utils.ts +97 -0
- package/src/queries/borrowIncentiveQuery.ts +2 -2
- package/src/queries/coreQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +1 -1
- package/src/{utils/query.ts → queries/utils.ts} +19 -1
- package/src/types/builder/index.ts +1 -26
- package/src/types/builder/type.ts +25 -0
- package/src/types/constant/package.ts +15 -2
- package/dist/address-CW2IpaLn.d.ts +0 -165
- package/dist/chunk-E3URAUAC.js +0 -25
- package/dist/chunk-YA77R5GT.mjs +0 -5
- package/dist/constants/index.d.mts +0 -262
- package/dist/constants/index.d.ts +0 -262
- package/dist/constants/index.js +0 -86
- package/dist/constants/index.mjs +0 -5
- package/dist/models/index.d.mts +0 -393
- package/dist/models/index.d.ts +0 -393
- package/dist/models/index.js +0 -34
- package/dist/models/index.mjs +0 -16
- package/dist/queryKeys-AaZqDYle.d.ts +0 -43
- package/dist/scallopUtils-BZLZd2z8.d.ts +0 -2404
- package/dist/types/index.d.mts +0 -9
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.js +0 -2
- package/dist/types/index.mjs +0 -1
- package/src/constants/package.ts +0 -14
- package/src/types/index.ts +0 -5
- package/src/utils/core.ts +0 -18
- package/src/utils/index.ts +0 -5
- package/src/utils/indexer.ts +0 -47
- package/src/utils/util.ts +0 -42
- /package/src/{utils/builder.ts → builders/utils.ts} +0 -0
- /package/src/types/{utils.ts → util.ts} +0 -0
|
@@ -326,24 +326,24 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
326
326
|
// versionCap: '',
|
|
327
327
|
},
|
|
328
328
|
vesca: {
|
|
329
|
-
id: '
|
|
329
|
+
id: '0x0c7f5568dbd69488437ee95f2d9a028724e1de12432965ff8acca7c67310ba46',
|
|
330
330
|
object:
|
|
331
|
-
'
|
|
331
|
+
'0x0c7f5568dbd69488437ee95f2d9a028724e1de12432965ff8acca7c67310ba46',
|
|
332
332
|
adminCap:
|
|
333
333
|
'0x4d105b16467acca81d18c132cdd1a3cee159920a86c1ef4bdbf2e8d7878500c5',
|
|
334
334
|
tableId:
|
|
335
|
-
'
|
|
336
|
-
table: '
|
|
335
|
+
'0x5477d43c9f75faea312c0f02dd48b4e03d9cbf2b1a5436ddffb5edefbea18ff2',
|
|
336
|
+
table: '0x06f763060ea5da3d639fb56df70674490a8354511cfe61584062aafd83b1940d',
|
|
337
337
|
treasury:
|
|
338
|
-
'
|
|
338
|
+
'0x934919cc31fa89b67578039bb10d5518fa23c50bc8f78500f1d1a718407a0a71',
|
|
339
339
|
config:
|
|
340
|
-
'
|
|
340
|
+
'0x38d3f7a1fa5071226535d4d8bfca8ccab3d24871402df1be669d7d5e9e3e9cb4',
|
|
341
341
|
subsTable:
|
|
342
|
-
'
|
|
342
|
+
'0x4756b716670ff62760b22bebed73c6eb2c2cb118674a2eea3a56ebea9e27ae76',
|
|
343
343
|
subsTableId:
|
|
344
344
|
'0xe9fa5d464d28fe30ad060ea32af577c68c9e82aca48ad1f10f13f35338472778',
|
|
345
345
|
subsWhitelist:
|
|
346
|
-
'
|
|
346
|
+
'0xfc72adae643da4f2fe080adc1e2cca981eadcb518facb02324eeaab169752ffb',
|
|
347
347
|
},
|
|
348
348
|
referral: {
|
|
349
349
|
id: '0x709ce9b97a63c6815c385ffd31c354dcd8f760984610581be23b838af4c6f60b',
|
|
@@ -449,7 +449,7 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
449
449
|
},
|
|
450
450
|
};
|
|
451
451
|
|
|
452
|
-
export const
|
|
452
|
+
export const TEST_WHITELIST = {
|
|
453
453
|
lending: new Set([
|
|
454
454
|
'usdc',
|
|
455
455
|
// 'sbeth',
|
|
@@ -584,7 +584,7 @@ export const WHITELIST = {
|
|
|
584
584
|
emerging: new Set(['wal', 'deep', 'sca', 'cetus']),
|
|
585
585
|
};
|
|
586
586
|
|
|
587
|
-
export const
|
|
587
|
+
export const TEST_POOL_ADDRESSES = {
|
|
588
588
|
usdc: {
|
|
589
589
|
coinName: 'usdc',
|
|
590
590
|
symbol: 'USDC',
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export {
|
|
3
|
+
Scallop,
|
|
4
|
+
ScallopConstants,
|
|
5
|
+
ScallopAddress,
|
|
6
|
+
ScallopBuilder,
|
|
7
|
+
ScallopQuery,
|
|
8
|
+
ScallopSuiKit,
|
|
9
|
+
ScallopClient,
|
|
10
|
+
ScallopIndexer,
|
|
11
|
+
ScallopUtils,
|
|
12
|
+
} from './models';
|
package/src/models/scallop.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AddressesInterface, AddressStringPath } from 'src/types/address';
|
|
|
5
5
|
import ScallopAxios, { ScallopAxiosParams } from './scallopAxios';
|
|
6
6
|
import { QueryKey } from '@tanstack/query-core';
|
|
7
7
|
import { AxiosRequestConfig } from 'axios';
|
|
8
|
-
import { parseUrl } from '
|
|
8
|
+
import { parseUrl } from './utils';
|
|
9
9
|
|
|
10
10
|
export type ScallopAddressParams = {
|
|
11
11
|
addressId?: string;
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
SuiTxArg,
|
|
13
13
|
SuiVecTxArg,
|
|
14
14
|
} from '@scallop-io/sui-kit';
|
|
15
|
-
import type { ScallopTxBlock, SelectCoinReturnType } from 'src/types';
|
|
15
|
+
import type { ScallopTxBlock, SelectCoinReturnType } from 'src/types/builder';
|
|
16
16
|
import { ScallopBuilderInterface } from './interface';
|
|
17
17
|
|
|
18
18
|
export type ScallopBuilderParams = {
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
TransactionObjectArgument,
|
|
6
6
|
TransactionResult,
|
|
7
7
|
} from '@mysten/sui/transactions';
|
|
8
|
-
import { requireSender } from '
|
|
8
|
+
import { requireSender } from './utils';
|
|
9
9
|
import type { NetworkType, SuiObjectArg } from '@scallop-io/sui-kit';
|
|
10
10
|
import { ScallopClientInterface } from './interface';
|
|
11
11
|
import { ScallopTxBlock } from 'src/types/builder';
|
|
@@ -2,7 +2,7 @@ import { PoolAddress, Whitelist } from 'src/types/constant';
|
|
|
2
2
|
import ScallopAddress, { ScallopAddressParams } from './scallopAddress';
|
|
3
3
|
import { NetworkType, parseStructTag } from '@scallop-io/sui-kit';
|
|
4
4
|
import { queryKeys } from 'src/constants/queryKeys';
|
|
5
|
-
import { parseUrl } from '
|
|
5
|
+
import { parseUrl } from './utils';
|
|
6
6
|
|
|
7
7
|
const isEmptyObject = (obj: object) => {
|
|
8
8
|
return Object.keys(obj).length === 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ScallopUtils, { ScallopUtilsParams } from './scallopUtils';
|
|
2
2
|
import ScallopIndexer, { ScallopIndexerParams } from './scallopIndexer';
|
|
3
|
-
import { withIndexerFallback } from '
|
|
3
|
+
import { withIndexerFallback } from './utils';
|
|
4
4
|
import {
|
|
5
5
|
MarketCollaterals,
|
|
6
6
|
MarketPool,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
getPriceUpdatePolicies,
|
|
77
77
|
getAssetOracles,
|
|
78
78
|
} from 'src/queries/xOracleQuery';
|
|
79
|
-
import { CoinPrices } from 'src/types/
|
|
79
|
+
import { CoinPrices } from 'src/types/util';
|
|
80
80
|
import { SupportOracleType, xOracleRules } from 'src/types/constant';
|
|
81
81
|
|
|
82
82
|
export type ScallopQueryParams = {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Transaction,
|
|
8
8
|
} from '@scallop-io/sui-kit';
|
|
9
9
|
import ScallopConstants, { ScallopConstantsParams } from './scallopConstants';
|
|
10
|
-
import { findClosestUnlockRound } from '
|
|
10
|
+
import { findClosestUnlockRound } from './utils';
|
|
11
11
|
import { PriceFeed, SuiPriceServiceConnection } from '@pythnetwork/pyth-sui-js';
|
|
12
12
|
import ScallopSuiKit, { ScallopSuiKitParams } from './scallopSuiKit';
|
|
13
13
|
import { SuiObjectData } from '@mysten/sui/dist/cjs/client';
|
|
@@ -16,7 +16,7 @@ import { ScallopUtilsInterface } from './interface';
|
|
|
16
16
|
import { MAX_LOCK_DURATION, UNLOCK_ROUND_DURATION } from 'src/constants/vesca';
|
|
17
17
|
import { queryKeys } from 'src/constants/queryKeys';
|
|
18
18
|
import { CoinWrappedType, PoolAddress } from 'src/types/constant';
|
|
19
|
-
import { CoinPrices } from 'src/types/
|
|
19
|
+
import { CoinPrices } from 'src/types/util';
|
|
20
20
|
|
|
21
21
|
export type ScallopUtilsParams = {
|
|
22
22
|
pythEndpoints?: string[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic wrapper for methods with indexer fallback.
|
|
3
|
+
*
|
|
4
|
+
* @param method - The method to call with fallback behavior.
|
|
5
|
+
* @param context - The context (`this`) of the class instance.
|
|
6
|
+
* @param args - The arguments to pass to the method.
|
|
7
|
+
* @returns The result of the method call.
|
|
8
|
+
*/
|
|
9
|
+
export async function callMethodWithIndexerFallback(
|
|
10
|
+
method: Function,
|
|
11
|
+
context: any,
|
|
12
|
+
...args: any[]
|
|
13
|
+
) {
|
|
14
|
+
const lastArgs = args[args.length - 1]; // Assume last argument is always `indexer`
|
|
15
|
+
|
|
16
|
+
if (typeof lastArgs === 'object' && lastArgs.indexer) {
|
|
17
|
+
try {
|
|
18
|
+
return await method.apply(context, args);
|
|
19
|
+
} catch (e: any) {
|
|
20
|
+
console.warn(
|
|
21
|
+
`Indexer requests failed: ${e.message}. Retrying without indexer..`
|
|
22
|
+
);
|
|
23
|
+
return await method.apply(context, [
|
|
24
|
+
...args.slice(0, -1),
|
|
25
|
+
{
|
|
26
|
+
...lastArgs,
|
|
27
|
+
indexer: false,
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return await method.apply(context, args);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* This function creates a wrapper for methods that have an indexer parameter.
|
|
37
|
+
* It ensures fallback behavior if indexer fails.
|
|
38
|
+
*
|
|
39
|
+
* @param method - The method to wrap.
|
|
40
|
+
* @returns A function that applies indexer fallback.
|
|
41
|
+
*/
|
|
42
|
+
export function withIndexerFallback(method: Function) {
|
|
43
|
+
return (...args: any[]) => {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
return callMethodWithIndexerFallback(method, this, ...args); // Preserve `this` with arrow function
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
import { SuiTxBlock } from '@scallop-io/sui-kit';
|
|
50
|
+
import { MAX_LOCK_DURATION } from 'src/constants/vesca';
|
|
51
|
+
// import { ScallopConstants } from 'src/models/scallopConstants';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Find the closest unlock round timestamp (12AM) to the given unlock at timestamp in seconds.
|
|
55
|
+
*
|
|
56
|
+
* @param unlockAtInSecondTimestamp - Unlock at in seconds timestamp to find the closest round.
|
|
57
|
+
* @returns Closest round (12AM) in seconds timestamp.
|
|
58
|
+
*/
|
|
59
|
+
export const findClosestUnlockRound = (unlockAtInSecondTimestamp: number) => {
|
|
60
|
+
const unlockDate = new Date(unlockAtInSecondTimestamp * 1000);
|
|
61
|
+
const closestTwelveAM = new Date(unlockAtInSecondTimestamp * 1000);
|
|
62
|
+
|
|
63
|
+
closestTwelveAM.setUTCHours(0, 0, 0, 0); // Set the time to the next 12 AM UTC
|
|
64
|
+
|
|
65
|
+
// If the current time is past 12 AM, set the date to the next day
|
|
66
|
+
if (unlockDate.getUTCHours() >= 0) {
|
|
67
|
+
closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() + 1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const now = new Date().getTime();
|
|
71
|
+
// check if unlock period > 4 years
|
|
72
|
+
if (closestTwelveAM.getTime() - now > MAX_LOCK_DURATION * 1000) {
|
|
73
|
+
closestTwelveAM.setUTCDate(closestTwelveAM.getUTCDate() - 1);
|
|
74
|
+
}
|
|
75
|
+
return Math.floor(closestTwelveAM.getTime() / 1000);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const parseUrl = (url: string) => {
|
|
79
|
+
if (url.endsWith('/')) {
|
|
80
|
+
url = url.slice(0, -1);
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Check and get the sender from the transaction block.
|
|
87
|
+
*
|
|
88
|
+
* @param txBlock - TxBlock created by SuiKit.
|
|
89
|
+
* @return Sender of transaction.
|
|
90
|
+
*/
|
|
91
|
+
export const requireSender = (txBlock: SuiTxBlock) => {
|
|
92
|
+
const sender = txBlock.blockData.sender;
|
|
93
|
+
if (!sender) {
|
|
94
|
+
throw new Error('Sender is required');
|
|
95
|
+
}
|
|
96
|
+
return sender;
|
|
97
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
parseOriginBorrowIncentivePoolData,
|
|
4
4
|
parseOriginBorrowIncentiveAccountData,
|
|
5
5
|
calculateBorrowIncentivePoolPointData,
|
|
6
|
-
} from '
|
|
6
|
+
} from './utils';
|
|
7
7
|
import type {
|
|
8
8
|
ScallopAddress,
|
|
9
9
|
ScallopQuery,
|
|
@@ -20,7 +20,7 @@ import type {
|
|
|
20
20
|
} from 'src/types/query';
|
|
21
21
|
import BigNumber from 'bignumber.js';
|
|
22
22
|
import { SuiObjectRef } from '@mysten/sui/client';
|
|
23
|
-
import { CoinPrices, OptionalKeys } from 'src/types/
|
|
23
|
+
import { CoinPrices, OptionalKeys } from 'src/types/util';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Query borrow incentive pools data using moveCall
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
|
-
import { minBigNumber, estimatedFactor } from '
|
|
2
|
+
import { minBigNumber, estimatedFactor } from './utils';
|
|
3
3
|
import type { ScallopQuery } from 'src/models';
|
|
4
4
|
import { SuiObjectRef } from '@mysten/sui/client';
|
|
5
5
|
import { normalizeStructTag, SUI_TYPE_ARG } from '@scallop-io/sui-kit';
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
StakeAccount,
|
|
19
19
|
TotalValueLocked,
|
|
20
20
|
} from 'src/types/query';
|
|
21
|
-
import { CoinPrices } from 'src/types/
|
|
21
|
+
import { CoinPrices } from 'src/types/util';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Get user lending infomation for specific pools.
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
parseOriginSpoolRewardPoolData,
|
|
6
6
|
calculateSpoolRewardPoolData,
|
|
7
7
|
parseObjectAs,
|
|
8
|
-
} from '
|
|
8
|
+
} from './utils';
|
|
9
9
|
import type { SuiObjectData, SuiObjectResponse } from '@mysten/sui/client';
|
|
10
10
|
import type { ScallopQuery, ScallopUtils } from 'src/models';
|
|
11
11
|
import { CoinPrices } from 'src/types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { normalizeStructTag } from '@mysten/sui/utils';
|
|
3
|
-
import type { ScallopUtils } from '
|
|
3
|
+
import type { ScallopUtils } from 'src/models';
|
|
4
4
|
import {
|
|
5
5
|
OriginMarketPoolData,
|
|
6
6
|
ParsedMarketPoolData,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
OriginBorrowIncentiveAccountData,
|
|
25
25
|
ParsedBorrowIncentiveAccountData,
|
|
26
26
|
} from 'src/types/query';
|
|
27
|
+
import { SuiObjectData } from '@mysten/sui/client';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Parse origin market pool data to a more readable format.
|
|
@@ -642,3 +643,20 @@ export const estimatedFactor = (
|
|
|
642
643
|
|
|
643
644
|
return adjustFactor;
|
|
644
645
|
};
|
|
646
|
+
|
|
647
|
+
export const parseObjectAs = <T>(object: SuiObjectData): T => {
|
|
648
|
+
if (!(object && object.content && 'fields' in object.content))
|
|
649
|
+
throw new Error(`Failed to parse object ${object}`);
|
|
650
|
+
|
|
651
|
+
const fields = object.content.fields as any;
|
|
652
|
+
|
|
653
|
+
if (typeof fields === 'object' && 'value' in fields) {
|
|
654
|
+
const value = fields.value;
|
|
655
|
+
if (typeof value === 'object' && 'fields' in value)
|
|
656
|
+
return value.fields as T;
|
|
657
|
+
return value as T;
|
|
658
|
+
} else if (typeof fields === 'object') {
|
|
659
|
+
return fields as T;
|
|
660
|
+
}
|
|
661
|
+
return fields as T;
|
|
662
|
+
};
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import type { CoreTxBlock, NestedResult } from './core';
|
|
2
|
-
import type { SpoolTxBlock } from './spool';
|
|
3
|
-
import type { BorrowIncentiveTxBlock } from './borrowIncentive';
|
|
4
|
-
import type { VeScaTxBlock } from './vesca';
|
|
5
|
-
import type { ReferralTxBlock } from './referral';
|
|
6
|
-
import { LoyaltyProgramTxBlock } from './loyaltyProgram';
|
|
7
|
-
import { SCoinTxBlock } from './sCoin';
|
|
8
|
-
|
|
9
1
|
export type * from './core';
|
|
10
2
|
export type * from './spool';
|
|
11
3
|
export type * from './borrowIncentive';
|
|
12
4
|
export type * from './vesca';
|
|
13
5
|
export type * from './loyaltyProgram';
|
|
14
6
|
export type * from './sCoin';
|
|
15
|
-
|
|
16
|
-
export type BaseScallopTxBlock = ReferralTxBlock &
|
|
17
|
-
LoyaltyProgramTxBlock &
|
|
18
|
-
BorrowIncentiveTxBlock &
|
|
19
|
-
VeScaTxBlock;
|
|
20
|
-
|
|
21
|
-
export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
22
|
-
export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
23
|
-
export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
24
|
-
|
|
25
|
-
export type SelectCoinReturnType<T extends string> = T extends 'sui'
|
|
26
|
-
? {
|
|
27
|
-
takeCoin: NestedResult;
|
|
28
|
-
}
|
|
29
|
-
: {
|
|
30
|
-
takeCoin: NestedResult;
|
|
31
|
-
leftCoin: NestedResult;
|
|
32
|
-
};
|
|
7
|
+
export type * from './type';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CoreTxBlock, NestedResult } from './core';
|
|
2
|
+
import type { SpoolTxBlock } from './spool';
|
|
3
|
+
import type { BorrowIncentiveTxBlock } from './borrowIncentive';
|
|
4
|
+
import type { VeScaTxBlock } from './vesca';
|
|
5
|
+
import type { ReferralTxBlock } from './referral';
|
|
6
|
+
import type { LoyaltyProgramTxBlock } from './loyaltyProgram';
|
|
7
|
+
import type { SCoinTxBlock } from './sCoin';
|
|
8
|
+
|
|
9
|
+
export type BaseScallopTxBlock = ReferralTxBlock &
|
|
10
|
+
LoyaltyProgramTxBlock &
|
|
11
|
+
BorrowIncentiveTxBlock &
|
|
12
|
+
VeScaTxBlock;
|
|
13
|
+
|
|
14
|
+
export type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
15
|
+
export type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
16
|
+
export type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
17
|
+
|
|
18
|
+
export type SelectCoinReturnType<T extends string> = T extends 'sui'
|
|
19
|
+
? {
|
|
20
|
+
takeCoin: NestedResult;
|
|
21
|
+
}
|
|
22
|
+
: {
|
|
23
|
+
takeCoin: NestedResult;
|
|
24
|
+
leftCoin: NestedResult;
|
|
25
|
+
};
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
const _PACKAGE_NAMES = [
|
|
2
|
+
'coinDecimalsRegistry',
|
|
3
|
+
'math',
|
|
4
|
+
'whitelist',
|
|
5
|
+
'x',
|
|
6
|
+
'protocol',
|
|
7
|
+
'protocolWhitelist',
|
|
8
|
+
'query',
|
|
9
|
+
'supra',
|
|
10
|
+
'pyth',
|
|
11
|
+
'switchboard',
|
|
12
|
+
'xOracle',
|
|
13
|
+
'testCoin',
|
|
14
|
+
] as const;
|
|
2
15
|
|
|
3
|
-
export type PackageName = (typeof
|
|
16
|
+
export type PackageName = (typeof _PACKAGE_NAMES)[number];
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
declare const PACKAGE_NAMES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
|
|
2
|
-
|
|
3
|
-
declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
4
|
-
declare const X_ORACLE_RULES: readonly ["primary", "secondary"];
|
|
5
|
-
declare const SUPPORT_ORACLE_LST: readonly ["pyth"];
|
|
6
|
-
declare const SUPPORT_SUI_LST: readonly ["afsui"];
|
|
7
|
-
declare const X_ORACLE_LIST: Record<string, Record<(typeof X_ORACLE_RULES)[number], (typeof SUPPORT_ORACLES)[number][]>>;
|
|
8
|
-
|
|
9
|
-
type SupportOracleType = (typeof SUPPORT_ORACLES)[number];
|
|
10
|
-
type xOracleRuleType = (typeof X_ORACLE_RULES)[number];
|
|
11
|
-
type xOracleRules = Record<xOracleRuleType, SupportOracleType[]>;
|
|
12
|
-
type xOracleListType = {
|
|
13
|
-
[key in string]: xOracleRules;
|
|
14
|
-
};
|
|
15
|
-
type SupportedOracleSuiLst = (typeof SUPPORT_SUI_LST)[number];
|
|
16
|
-
|
|
17
|
-
type PackageName = (typeof PACKAGE_NAMES)[number];
|
|
18
|
-
|
|
19
|
-
type BasePackage = {
|
|
20
|
-
id: string;
|
|
21
|
-
object?: string;
|
|
22
|
-
upgradeCap?: string;
|
|
23
|
-
};
|
|
24
|
-
type OracleLstPackage = {
|
|
25
|
-
[K in SupportedOracleSuiLst]: BasePackage;
|
|
26
|
-
};
|
|
27
|
-
type OraclePackage<T> = BasePackage & T extends SupportOracleLst ? BasePackage & {
|
|
28
|
-
lst: OracleLstPackage;
|
|
29
|
-
} : BasePackage;
|
|
30
|
-
type Packages<T extends SupportOracleType | PackageName = SupportOracleType | PackageName> = T extends SupportOracleType ? Record<T, OraclePackage<T>> : T extends PackageName ? Record<T, BasePackage> : never;
|
|
31
|
-
type SupportOracleLst = (typeof SUPPORT_ORACLE_LST)[number];
|
|
32
|
-
type OracleLstConfig<T extends SupportedOracleSuiLst> = T extends 'afsui' ? Record<T, {
|
|
33
|
-
stakedSuiVaultId: string;
|
|
34
|
-
safeId: string;
|
|
35
|
-
configId: string;
|
|
36
|
-
}> : never;
|
|
37
|
-
type OracleLst<T extends SupportOracleLst, U extends SupportedOracleSuiLst = SupportedOracleSuiLst> = T extends 'pyth' ? OracleLstConfig<U> : undefined;
|
|
38
|
-
type MaybeWithOracleLst<T, U> = T extends SupportOracleLst ? U & {
|
|
39
|
-
lst: OracleLst<T>;
|
|
40
|
-
} : U;
|
|
41
|
-
interface AddressesInterface {
|
|
42
|
-
id?: string;
|
|
43
|
-
core: {
|
|
44
|
-
version: string;
|
|
45
|
-
versionCap: string;
|
|
46
|
-
object: string;
|
|
47
|
-
market: string;
|
|
48
|
-
adminCap: string;
|
|
49
|
-
coinDecimalsRegistry: string;
|
|
50
|
-
obligationAccessStore: string;
|
|
51
|
-
coins: Partial<Record<string, {
|
|
52
|
-
id: string;
|
|
53
|
-
treasury: string;
|
|
54
|
-
metaData: string;
|
|
55
|
-
coinType: string;
|
|
56
|
-
symbol: string;
|
|
57
|
-
decimals: number;
|
|
58
|
-
oracle: {
|
|
59
|
-
[K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0] ? string : K extends (typeof SUPPORT_ORACLES)[1] ? string : K extends (typeof SUPPORT_ORACLES)[2] ? {
|
|
60
|
-
feed: string;
|
|
61
|
-
feedObject: string;
|
|
62
|
-
} : never;
|
|
63
|
-
};
|
|
64
|
-
}>>;
|
|
65
|
-
oracles: {
|
|
66
|
-
[K in SupportOracleType]: K extends (typeof SUPPORT_ORACLES)[0] ? MaybeWithOracleLst<K, {
|
|
67
|
-
registry: string;
|
|
68
|
-
registryCap: string;
|
|
69
|
-
holder: string;
|
|
70
|
-
}> : K extends (typeof SUPPORT_ORACLES)[1] ? MaybeWithOracleLst<K, {
|
|
71
|
-
registry: string;
|
|
72
|
-
registryCap: string;
|
|
73
|
-
registryTableId: string;
|
|
74
|
-
state: string;
|
|
75
|
-
}> : K extends (typeof SUPPORT_ORACLES)[2] ? MaybeWithOracleLst<K, {
|
|
76
|
-
registry: string;
|
|
77
|
-
registryCap: string;
|
|
78
|
-
state: string;
|
|
79
|
-
wormhole: string;
|
|
80
|
-
wormholeState: string;
|
|
81
|
-
}> : never;
|
|
82
|
-
} & {
|
|
83
|
-
xOracle: string;
|
|
84
|
-
xOracleCap: string;
|
|
85
|
-
primaryPriceUpdatePolicyObject: string;
|
|
86
|
-
secondaryPriceUpdatePolicyObject: string;
|
|
87
|
-
primaryPriceUpdatePolicyVecsetId: string;
|
|
88
|
-
secondaryPriceUpdatePolicyVecsetId: string;
|
|
89
|
-
};
|
|
90
|
-
packages: Packages;
|
|
91
|
-
};
|
|
92
|
-
spool: {
|
|
93
|
-
id: string;
|
|
94
|
-
adminCap: string;
|
|
95
|
-
object: string;
|
|
96
|
-
config: string;
|
|
97
|
-
pools: Partial<Record<string, {
|
|
98
|
-
id: string;
|
|
99
|
-
rewardPoolId: string;
|
|
100
|
-
}>>;
|
|
101
|
-
};
|
|
102
|
-
borrowIncentive: {
|
|
103
|
-
id: string;
|
|
104
|
-
adminCap: string;
|
|
105
|
-
object: string;
|
|
106
|
-
query: string;
|
|
107
|
-
config: string;
|
|
108
|
-
incentivePools: string;
|
|
109
|
-
incentiveAccounts: string;
|
|
110
|
-
};
|
|
111
|
-
vesca: {
|
|
112
|
-
id: string;
|
|
113
|
-
object: string;
|
|
114
|
-
adminCap: string;
|
|
115
|
-
tableId: string;
|
|
116
|
-
table: string;
|
|
117
|
-
treasury: string;
|
|
118
|
-
config: string;
|
|
119
|
-
subsTable: string;
|
|
120
|
-
subsTableId: string;
|
|
121
|
-
subsWhitelist: string;
|
|
122
|
-
};
|
|
123
|
-
referral: {
|
|
124
|
-
id: string;
|
|
125
|
-
version: string;
|
|
126
|
-
object: string;
|
|
127
|
-
adminCap: string;
|
|
128
|
-
referralBindings: string;
|
|
129
|
-
bindingTableId: string;
|
|
130
|
-
referralRevenuePool: string;
|
|
131
|
-
revenueTableId: string;
|
|
132
|
-
referralTiers: string;
|
|
133
|
-
tiersTableId: string;
|
|
134
|
-
authorizedWitnessList: string;
|
|
135
|
-
};
|
|
136
|
-
loyaltyProgram: {
|
|
137
|
-
id: string;
|
|
138
|
-
adminCap?: string;
|
|
139
|
-
object: string;
|
|
140
|
-
rewardPool: string;
|
|
141
|
-
userRewardTableId: string;
|
|
142
|
-
};
|
|
143
|
-
veScaLoyaltyProgram: {
|
|
144
|
-
id: string;
|
|
145
|
-
adminCap?: string;
|
|
146
|
-
object: string;
|
|
147
|
-
veScaRewardPool: string;
|
|
148
|
-
veScaRewardTableId: string;
|
|
149
|
-
};
|
|
150
|
-
scoin: {
|
|
151
|
-
id: string;
|
|
152
|
-
coins: Partial<Record<string, {
|
|
153
|
-
coinType: string;
|
|
154
|
-
symbol: string;
|
|
155
|
-
treasury: string;
|
|
156
|
-
metaData: string;
|
|
157
|
-
}>>;
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
type Paths<T> = T extends object ? {
|
|
161
|
-
[K in Extract<keyof T, string>]: T[K] extends object ? K | `${K}.${Paths<T[K]>}` : K;
|
|
162
|
-
}[Extract<keyof T, string>] : never;
|
|
163
|
-
type AddressStringPath = Paths<AddressesInterface>;
|
|
164
|
-
|
|
165
|
-
export { type AddressesInterface as A, type BasePackage as B, type OracleLstPackage as O, PACKAGE_NAMES as P, SUPPORT_ORACLES as S, X_ORACLE_RULES as X, SUPPORT_ORACLE_LST as a, SUPPORT_SUI_LST as b, X_ORACLE_LIST as c, type SupportOracleType as d, type xOracleRules as e, type xOracleListType as f, type SupportedOracleSuiLst as g, type PackageName as h, type SupportOracleLst as i, type OracleLstConfig as j, type OracleLst as k, type AddressStringPath as l, type xOracleRuleType as x };
|
package/dist/chunk-E3URAUAC.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var client = require('@mysten/sui/client');
|
|
4
|
-
|
|
5
|
-
var s="https://sui.apis.scallop.io",r="https://sdk.api.scallop.io";var o={defaultOptions:{queries:{staleTime:5e3,gcTime:5e3}}};var n=!1,i=!1,p="0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",y="0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";var u={api:{getAddresses:e=>["api","getAddresses",e],getWhiteList:()=>["api","getWhiteList"],getPoolAddresses:()=>["api","getPoolAddresses"],getMarket:()=>["api","getMarket"],getSpools:()=>["api","getSpools"],getBorrowIncentivePool:()=>["api","getBorrowIncentivePools"],getTotalValueLocked:()=>["api","getTotalValueLocked"]},rpc:{getInspectTxn:e=>["rpc","getInspectTxn",e],getObject:e=>["rpc","getObject",e],getObjects:e=>["rpc","getObjects",e],getOwnedObjects:e=>["rpc","getOwnedObjects",{...e,filter:JSON.stringify(e?.filter??void 0)}],getDynamicFields:e=>["rpc","getDynamicFields",e],getDynamicFieldObject:e=>["rpc","getDynamicFieldObject",e],getTotalVeScaTreasuryAmount:e=>["rpc","getTotalVeScaTreasuryAmount",{...e,refreshArgs:e?.refreshArgs?JSON.stringify(e?.refreshArgs):void 0,vescaAmountArgs:e?.vescaAmountArgs?JSON.stringify(e?.vescaAmountArgs):void 0}],getAllCoinBalances:e=>["rpc","getAllCoinBalances",e],getNormalizedMoveFunction:e=>["rpc","getNormalizedMoveCall",e]},oracle:{getPythLatestPriceFeeds:()=>["oracle","getPythPriceIds"]}};var _=[client.getFullnodeUrl("mainnet"),"https://sui-mainnet.public.blastapi.io","https://sui-mainnet-ca-2.cosmostation.io","https://sui-mainnet-eu-4.cosmostation.io","https://sui-mainnet-endpoint.blockvision.org","https://sui-rpc.publicnode.com","https://sui-mainnet-rpc.allthatnode.com","https://mainnet.suiet.app","https://mainnet.sui.rpcpool.com","https://sui1mainnet-rpc.chainode.tech","https://fullnode.mainnet.apis.scallop.io","https://sui-mainnet-us-2.cosmostation.io"];var h=86400,g=1460,A=126144e3,S=1e10,R=1e9;var b=["supra","switchboard","pyth"],C=["primary","secondary"],f=["pyth"],P=["afsui"],L={usdc:{primary:["pyth"],secondary:[]},sbeth:{primary:["pyth"],secondary:[]},sbusdt:{primary:["pyth"],secondary:[]},sbwbtc:{primary:["pyth"],secondary:[]},weth:{primary:["pyth"],secondary:[]},wbtc:{primary:["pyth"],secondary:[]},wusdc:{primary:["pyth"],secondary:[]},wusdt:{primary:["pyth"],secondary:[]},sui:{primary:["pyth"],secondary:[]},wapt:{primary:["pyth"],secondary:[]},wsol:{primary:["pyth"],secondary:[]},cetus:{primary:["pyth"],secondary:[]},afsui:{primary:["pyth"],secondary:[]},hasui:{primary:["pyth"],secondary:[]},vsui:{primary:["pyth"],secondary:[]},sca:{primary:["pyth"],secondary:[]},fud:{primary:["pyth"],secondary:[]},deep:{primary:["pyth"],secondary:[]},fdusd:{primary:["pyth"],secondary:[]},blub:{primary:["pyth"],secondary:[]},musd:{primary:["pyth"],secondary:[]},ns:{primary:["pyth"],secondary:[]},usdy:{primary:["pyth"],secondary:[]}};
|
|
6
|
-
|
|
7
|
-
exports.a = s;
|
|
8
|
-
exports.b = r;
|
|
9
|
-
exports.c = o;
|
|
10
|
-
exports.d = n;
|
|
11
|
-
exports.e = i;
|
|
12
|
-
exports.f = p;
|
|
13
|
-
exports.g = y;
|
|
14
|
-
exports.h = u;
|
|
15
|
-
exports.i = _;
|
|
16
|
-
exports.j = h;
|
|
17
|
-
exports.k = g;
|
|
18
|
-
exports.l = A;
|
|
19
|
-
exports.m = S;
|
|
20
|
-
exports.n = R;
|
|
21
|
-
exports.o = b;
|
|
22
|
-
exports.p = C;
|
|
23
|
-
exports.q = f;
|
|
24
|
-
exports.r = P;
|
|
25
|
-
exports.s = L;
|
package/dist/chunk-YA77R5GT.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { getFullnodeUrl } from '@mysten/sui/client';
|
|
2
|
-
|
|
3
|
-
var s="https://sui.apis.scallop.io",r="https://sdk.api.scallop.io";var o={defaultOptions:{queries:{staleTime:5e3,gcTime:5e3}}};var n=!1,i=!1,p="0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",y="0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";var u={api:{getAddresses:e=>["api","getAddresses",e],getWhiteList:()=>["api","getWhiteList"],getPoolAddresses:()=>["api","getPoolAddresses"],getMarket:()=>["api","getMarket"],getSpools:()=>["api","getSpools"],getBorrowIncentivePool:()=>["api","getBorrowIncentivePools"],getTotalValueLocked:()=>["api","getTotalValueLocked"]},rpc:{getInspectTxn:e=>["rpc","getInspectTxn",e],getObject:e=>["rpc","getObject",e],getObjects:e=>["rpc","getObjects",e],getOwnedObjects:e=>["rpc","getOwnedObjects",{...e,filter:JSON.stringify(e?.filter??void 0)}],getDynamicFields:e=>["rpc","getDynamicFields",e],getDynamicFieldObject:e=>["rpc","getDynamicFieldObject",e],getTotalVeScaTreasuryAmount:e=>["rpc","getTotalVeScaTreasuryAmount",{...e,refreshArgs:e?.refreshArgs?JSON.stringify(e?.refreshArgs):void 0,vescaAmountArgs:e?.vescaAmountArgs?JSON.stringify(e?.vescaAmountArgs):void 0}],getAllCoinBalances:e=>["rpc","getAllCoinBalances",e],getNormalizedMoveFunction:e=>["rpc","getNormalizedMoveCall",e]},oracle:{getPythLatestPriceFeeds:()=>["oracle","getPythPriceIds"]}};var _=[getFullnodeUrl("mainnet"),"https://sui-mainnet.public.blastapi.io","https://sui-mainnet-ca-2.cosmostation.io","https://sui-mainnet-eu-4.cosmostation.io","https://sui-mainnet-endpoint.blockvision.org","https://sui-rpc.publicnode.com","https://sui-mainnet-rpc.allthatnode.com","https://mainnet.suiet.app","https://mainnet.sui.rpcpool.com","https://sui1mainnet-rpc.chainode.tech","https://fullnode.mainnet.apis.scallop.io","https://sui-mainnet-us-2.cosmostation.io"];var h=86400,g=1460,A=126144e3,S=1e10,R=1e9;var b=["supra","switchboard","pyth"],C=["primary","secondary"],f=["pyth"],P=["afsui"],L={usdc:{primary:["pyth"],secondary:[]},sbeth:{primary:["pyth"],secondary:[]},sbusdt:{primary:["pyth"],secondary:[]},sbwbtc:{primary:["pyth"],secondary:[]},weth:{primary:["pyth"],secondary:[]},wbtc:{primary:["pyth"],secondary:[]},wusdc:{primary:["pyth"],secondary:[]},wusdt:{primary:["pyth"],secondary:[]},sui:{primary:["pyth"],secondary:[]},wapt:{primary:["pyth"],secondary:[]},wsol:{primary:["pyth"],secondary:[]},cetus:{primary:["pyth"],secondary:[]},afsui:{primary:["pyth"],secondary:[]},hasui:{primary:["pyth"],secondary:[]},vsui:{primary:["pyth"],secondary:[]},sca:{primary:["pyth"],secondary:[]},fud:{primary:["pyth"],secondary:[]},deep:{primary:["pyth"],secondary:[]},fdusd:{primary:["pyth"],secondary:[]},blub:{primary:["pyth"],secondary:[]},musd:{primary:["pyth"],secondary:[]},ns:{primary:["pyth"],secondary:[]},usdy:{primary:["pyth"],secondary:[]}};
|
|
4
|
-
|
|
5
|
-
export { s as a, r as b, o as c, n as d, i as e, p as f, y as g, u as h, _ as i, h as j, g as k, A as l, S as m, R as n, b as o, C as p, f as q, P as r, L as s };
|