@scallop-io/sui-scallop-sdk 2.4.3 → 2.4.4
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.cts → index.d.mts} +126 -189
- package/dist/index.d.ts +126 -189
- package/dist/index.js +50 -14
- package/dist/index.mjs +16 -0
- package/package.json +25 -18
- package/src/builders/borrowIncentiveBuilder.ts +19 -22
- package/src/builders/coreBuilder.ts +59 -83
- package/src/builders/index.ts +17 -10
- package/src/builders/loyaltyProgramBuilder.ts +5 -5
- package/src/builders/obligationNamingBuilder.ts +104 -0
- package/src/builders/oracles/index.ts +49 -64
- package/src/builders/oracles/pyth.ts +5 -20
- package/src/builders/referralBuilder.ts +11 -4
- package/src/builders/sCoinBuilder.ts +3 -3
- package/src/builders/spoolBuilder.ts +6 -6
- package/src/builders/vescaBuilder.ts +21 -29
- package/src/constants/index.ts +8 -7
- package/src/constants/queryKeys.ts +1 -1
- package/src/constants/rpc.ts +14 -4
- package/src/constants/testAddress.ts +1 -1
- package/src/constants/xoracle.ts +1 -1
- package/src/index.ts +3 -3
- package/src/models/index.ts +11 -11
- package/src/models/interface.ts +6 -6
- package/src/models/scallop.ts +1 -1
- package/src/models/scallopAddress.ts +4 -4
- package/src/models/scallopAxios.ts +1 -1
- package/src/models/scallopBuilder.ts +9 -6
- package/src/models/scallopClient.ts +12 -79
- package/src/models/scallopConstants.ts +4 -4
- package/src/models/scallopIndexer.ts +3 -3
- package/src/models/scallopQuery.ts +85 -35
- package/src/models/scallopQueryClient.ts +1 -1
- package/src/models/scallopSuiKit.ts +58 -158
- package/src/models/scallopUtils.ts +45 -75
- package/src/models/suiKit.ts +1 -1
- package/src/queries/borrowIncentiveQuery.ts +54 -78
- package/src/queries/borrowLimitQuery.ts +21 -4
- package/src/queries/coreQuery.ts +201 -212
- package/src/queries/flashloanFeeQuery.ts +21 -21
- package/src/queries/index.ts +16 -15
- package/src/queries/isolatedAssetQuery.ts +31 -10
- package/src/queries/loyaltyProgramQuery.ts +49 -56
- package/src/queries/obligationNamingQuery.ts +111 -0
- package/src/queries/poolAddressesQuery.ts +91 -115
- package/src/queries/portfolioQuery.ts +5 -5
- package/src/queries/priceQuery.ts +3 -3
- package/src/queries/referralQuery.ts +5 -15
- package/src/queries/sCoinQuery.ts +19 -28
- package/src/queries/spoolQuery.ts +31 -55
- package/src/queries/supplyLimitQuery.ts +20 -4
- package/src/queries/switchboardQuery.ts +6 -7
- package/src/queries/vescaQuery.ts +73 -77
- package/src/queries/xOracleQuery.ts +22 -47
- package/src/types/address.ts +5 -1
- package/src/types/builder/borrowIncentive.ts +1 -1
- package/src/types/builder/core.ts +3 -42
- package/src/types/builder/index.ts +16 -13
- package/src/types/builder/loyaltyProgram.ts +1 -1
- package/src/types/builder/obligationNaming.ts +35 -0
- package/src/types/builder/referral.ts +2 -1
- package/src/types/builder/sCoin.ts +2 -2
- package/src/types/builder/spool.ts +2 -2
- package/src/types/builder/vesca.ts +2 -11
- package/src/types/constant/index.ts +3 -3
- package/src/types/constant/queryKeys.ts +5 -15
- package/src/types/index.ts +5 -6
- package/src/types/query/core.ts +42 -18
- package/src/types/query/index.ts +7 -7
- package/src/types/query/portfolio.ts +2 -2
- package/src/types/query/spool.ts +5 -2
- package/src/types/query/vesca.ts +4 -2
- package/src/utils/builder.ts +2 -14
- package/src/utils/core.ts +18 -0
- package/src/utils/index.ts +6 -7
- package/src/utils/object.ts +47 -272
- package/src/utils/query.ts +4 -4
- package/src/utils/{vesca.ts → util.ts} +8 -1
- package/dist/index.cjs +0 -46
- package/src/types/sui.ts +0 -96
- package/src/utils/dynamicField.ts +0 -67
- package/src/utils/url.ts +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as _mysten_sui_dist_cjs_client from '@mysten/sui/dist/cjs/client';
|
|
2
|
+
import { SuiObjectDataOptions, GetOwnedObjectsParams, GetDynamicFieldsParams, GetDynamicFieldObjectParams, SuiObjectData, SuiObjectResponse, DynamicFieldPage, CoinBalance, GetBalanceParams, DevInspectResults, SuiObjectRef, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
3
3
|
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
4
|
-
import { SuiObjectArg, SuiTxArg,
|
|
4
|
+
import { SuiObjectArg, SuiTxArg, NetworkType, SuiKit, SuiKitParams, Transaction, SuiTxBlock, DerivePathParams, SuiVecTxArg, SuiAmountsArg, SuiAddressArg, TransactionResult as TransactionResult$1 } from '@scallop-io/sui-kit';
|
|
5
5
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
6
6
|
import { QueryClient, QueryClientConfig, QueryKey } from '@tanstack/query-core';
|
|
7
7
|
import { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
@@ -29,89 +29,6 @@ declare const USE_TEST_ADDRESS: boolean;
|
|
|
29
29
|
declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
30
30
|
declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
31
31
|
|
|
32
|
-
/** Sui Object with content and json (from getObject, listOwnedObjects, etc.) */
|
|
33
|
-
type SuiObjectData = SuiClientTypes.Object<{
|
|
34
|
-
content: true;
|
|
35
|
-
json: true;
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* SDK v2 GetObjectResponse format
|
|
39
|
-
* getObject, getDynamicField, etc. return { object: Object | null }
|
|
40
|
-
*/
|
|
41
|
-
type SuiObjectResponse = {
|
|
42
|
-
object: SuiObjectData | null;
|
|
43
|
-
};
|
|
44
|
-
/** Move object parsed content (dataType, fields structure) */
|
|
45
|
-
type SuiParsedData = {
|
|
46
|
-
dataType?: string;
|
|
47
|
-
type?: string;
|
|
48
|
-
hasPublicTransfer?: boolean;
|
|
49
|
-
fields?: Record<string, unknown>;
|
|
50
|
-
};
|
|
51
|
-
type SuiObjectRef = {
|
|
52
|
-
objectId: string;
|
|
53
|
-
version: number | string;
|
|
54
|
-
digest: string;
|
|
55
|
-
};
|
|
56
|
-
/** Paginated objects response (listDynamicFields, getOwnedObjects, etc.) */
|
|
57
|
-
type PaginatedObjectsResponse<T = unknown> = {
|
|
58
|
-
objects?: T[];
|
|
59
|
-
hasNextPage?: boolean;
|
|
60
|
-
cursor?: string | null;
|
|
61
|
-
};
|
|
62
|
-
/** Extract parsedJson from queryInspectTxn result (Transaction.events[0].parsedJson) */
|
|
63
|
-
type InspectTxnParsedJson<T> = {
|
|
64
|
-
Transaction?: {
|
|
65
|
-
events?: Array<{
|
|
66
|
-
parsedJson?: T;
|
|
67
|
-
}>;
|
|
68
|
-
};
|
|
69
|
-
commandResults?: unknown;
|
|
70
|
-
} | null | undefined;
|
|
71
|
-
type EncodeDynamicFieldNameInput = {
|
|
72
|
-
type: string;
|
|
73
|
-
} & ({
|
|
74
|
-
value: any;
|
|
75
|
-
bcs?: never;
|
|
76
|
-
} | {
|
|
77
|
-
value?: never;
|
|
78
|
-
bcs: Uint8Array;
|
|
79
|
-
});
|
|
80
|
-
type GetBalanceParams = {
|
|
81
|
-
owner: string;
|
|
82
|
-
coinType?: string | null;
|
|
83
|
-
};
|
|
84
|
-
type GetDynamicFieldObjectParams<T extends EncodeDynamicFieldNameInput = EncodeDynamicFieldNameInput> = {
|
|
85
|
-
parentId: string;
|
|
86
|
-
name: T;
|
|
87
|
-
};
|
|
88
|
-
type GetDynamicFieldsParams = {
|
|
89
|
-
parentId: string;
|
|
90
|
-
cursor?: string | null;
|
|
91
|
-
limit?: number | null;
|
|
92
|
-
};
|
|
93
|
-
type GetOwnedObjectsParams = {
|
|
94
|
-
owner: string;
|
|
95
|
-
filter?: any;
|
|
96
|
-
options?: SuiClientTypes.ObjectInclude;
|
|
97
|
-
cursor?: string | null;
|
|
98
|
-
limit?: number | null;
|
|
99
|
-
};
|
|
100
|
-
type CoinBalance = {
|
|
101
|
-
coinType: string;
|
|
102
|
-
balance: string;
|
|
103
|
-
coinBalance?: bigint;
|
|
104
|
-
addressBalance?: bigint;
|
|
105
|
-
};
|
|
106
|
-
type DevInspectResults = SuiClientTypes.SimulateTransactionResult<{
|
|
107
|
-
effects: true;
|
|
108
|
-
events: true;
|
|
109
|
-
balanceChanges: true;
|
|
110
|
-
commandResults: true;
|
|
111
|
-
}>;
|
|
112
|
-
type DynamicFieldPage = SuiClientTypes.ListDynamicFieldsResponse;
|
|
113
|
-
type SuiObjectDataOptions = SuiClientTypes.ObjectInclude;
|
|
114
|
-
|
|
115
32
|
declare namespace QueryKeys {
|
|
116
33
|
namespace API {
|
|
117
34
|
type GetAddresses = {
|
|
@@ -139,7 +56,7 @@ declare namespace QueryKeys {
|
|
|
139
56
|
export type GetDynamicFieldObject = BaseType & Partial<GetDynamicFieldObjectParams>;
|
|
140
57
|
export type getTotalVeScaTreasuryAmount = BaseType & {
|
|
141
58
|
refreshArgs?: any[];
|
|
142
|
-
vescaAmountArgs?: (string | SuiObjectData | SuiTxArg
|
|
59
|
+
vescaAmountArgs?: (string | SuiObjectData | SuiTxArg)[];
|
|
143
60
|
};
|
|
144
61
|
export type GetAllCoinBalances = BaseType & {
|
|
145
62
|
activeAddress?: string;
|
|
@@ -169,9 +86,10 @@ declare const queryKeys: {
|
|
|
169
86
|
filter: string;
|
|
170
87
|
node?: string;
|
|
171
88
|
owner?: string | undefined;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
89
|
+
cursor?: string | null | undefined;
|
|
90
|
+
limit?: number | null | undefined;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
options?: _mysten_sui_dist_cjs_client.SuiObjectDataOptions | null;
|
|
175
93
|
})[];
|
|
176
94
|
getDynamicFields: (props?: QueryKeys.RPC.GetDynamicFields) => (string | QueryKeys.RPC.GetDynamicFields | undefined)[];
|
|
177
95
|
getDynamicFieldObject: (props?: QueryKeys.RPC.GetDynamicFieldObject) => (string | QueryKeys.RPC.GetDynamicFieldObject | undefined)[];
|
|
@@ -556,13 +474,13 @@ declare class ScallopSuiKit extends ScallopQueryClient {
|
|
|
556
474
|
private rateLimiter;
|
|
557
475
|
constructor(params?: ScallopSuiKitParams);
|
|
558
476
|
switchFullNodes(fullNodes: string[]): void;
|
|
559
|
-
get client():
|
|
477
|
+
get client(): _mysten_sui_dist_cjs_client.SuiClient;
|
|
560
478
|
get walletAddress(): string;
|
|
561
479
|
set walletAddress(value: string);
|
|
562
480
|
get tokensPerSecond(): number;
|
|
563
481
|
set tokensPerSecond(value: number);
|
|
564
482
|
get currentFullNode(): string;
|
|
565
|
-
signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<
|
|
483
|
+
signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<_mysten_sui_dist_cjs_client.SuiTransactionBlockResponse>;
|
|
566
484
|
private callWithRateLimiter;
|
|
567
485
|
private queryGetNormalizedMoveFunction;
|
|
568
486
|
/**
|
|
@@ -571,7 +489,7 @@ declare class ScallopSuiKit extends ScallopQueryClient {
|
|
|
571
489
|
* @param QueryObjectParams
|
|
572
490
|
* @returns Promise<SuiObjectResponse>
|
|
573
491
|
*/
|
|
574
|
-
queryGetObject(objectId: string, options?: SuiObjectDataOptions): Promise<
|
|
492
|
+
queryGetObject(objectId: string, options?: SuiObjectDataOptions): Promise<SuiObjectResponse>;
|
|
575
493
|
/**
|
|
576
494
|
* @description Provides cache for getObjects of the SuiKit.
|
|
577
495
|
* @param objectIds
|
|
@@ -583,7 +501,7 @@ declare class ScallopSuiKit extends ScallopQueryClient {
|
|
|
583
501
|
* @param input
|
|
584
502
|
* @returns Promise<PaginatedObjectsResponse>
|
|
585
503
|
*/
|
|
586
|
-
queryGetOwnedObjects(input: GetOwnedObjectsParams): Promise<PaginatedObjectsResponse
|
|
504
|
+
queryGetOwnedObjects(input: GetOwnedObjectsParams): Promise<_mysten_sui_dist_cjs_client.PaginatedObjectsResponse>;
|
|
587
505
|
queryGetDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage | null>;
|
|
588
506
|
queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse | null>;
|
|
589
507
|
queryGetAllCoinBalances(owner: string): Promise<{
|
|
@@ -597,11 +515,6 @@ declare class ScallopSuiKit extends ScallopQueryClient {
|
|
|
597
515
|
* @returns Promise<DevInspectResults>
|
|
598
516
|
*/
|
|
599
517
|
queryInspectTxn({ queryTarget, args, typeArgs, txBlock, keys, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
|
|
600
|
-
/**
|
|
601
|
-
* v2: Use JSON-RPC devInspectTransactionBlock for read-only simulation.
|
|
602
|
-
* Bypasses strict gRPC simulateTransaction (ownership/gas checks).
|
|
603
|
-
*/
|
|
604
|
-
devInspectTxn(txBlock: SuiTxBlock): Promise<DevInspectResults>;
|
|
605
518
|
}
|
|
606
519
|
|
|
607
520
|
type ScallopQueryParams = {
|
|
@@ -996,20 +909,11 @@ declare class ScallopQuery implements ScallopQueryInterface {
|
|
|
996
909
|
*/
|
|
997
910
|
getVeScaKeyIdFromReferralBindings(walletAddress?: string): Promise<string | null>;
|
|
998
911
|
/**
|
|
999
|
-
*
|
|
912
|
+
* Get binded obligationId from a veScaKey if it exists.
|
|
1000
913
|
* @param veScaKey
|
|
1001
914
|
* @returns obligationId
|
|
1002
915
|
*/
|
|
1003
|
-
getBindedObligationId(veScaKey: string): Promise<string |
|
|
1004
|
-
/**
|
|
1005
|
-
* Get binded obligation from a veScaKey if it exists.
|
|
1006
|
-
* @param veScaKey
|
|
1007
|
-
* @returns { obligationId, obligationKey } if binded, otherwise null
|
|
1008
|
-
*/
|
|
1009
|
-
getBindedObligation(veScaKey: string): Promise<{
|
|
1010
|
-
obligationId: string;
|
|
1011
|
-
obligationKey: string;
|
|
1012
|
-
} | null>;
|
|
916
|
+
getBindedObligationId(veScaKey: string): Promise<string | null>;
|
|
1013
917
|
/**
|
|
1014
918
|
* Get binded veSCA key from a obligationId if it exists.
|
|
1015
919
|
* @param obligationId
|
|
@@ -1180,8 +1084,8 @@ declare class ScallopQuery implements ScallopQueryInterface {
|
|
|
1180
1084
|
* @returns price update policies
|
|
1181
1085
|
*/
|
|
1182
1086
|
getPriceUpdatePolicies(): Promise<{
|
|
1183
|
-
primary: SuiObjectResponse | null;
|
|
1184
|
-
secondary: SuiObjectResponse | null;
|
|
1087
|
+
primary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1088
|
+
secondary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1185
1089
|
}>;
|
|
1186
1090
|
/**
|
|
1187
1091
|
* Return the supported primary and secondary oracles for all supported pool assets
|
|
@@ -1194,6 +1098,21 @@ declare class ScallopQuery implements ScallopQueryInterface {
|
|
|
1194
1098
|
* @returns
|
|
1195
1099
|
*/
|
|
1196
1100
|
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
1101
|
+
/**
|
|
1102
|
+
* Get the custom name assigned to an obligation key.
|
|
1103
|
+
*
|
|
1104
|
+
* @param obligationKeyId - The obligation key object ID.
|
|
1105
|
+
* @param owner - The owner address (defaults to wallet address).
|
|
1106
|
+
* @return The obligation name, or null if not set.
|
|
1107
|
+
*/
|
|
1108
|
+
getObligationName(obligationKeyId: string, owner?: string): Promise<string | null>;
|
|
1109
|
+
/**
|
|
1110
|
+
* Get all obligation names for a given owner.
|
|
1111
|
+
*
|
|
1112
|
+
* @param owner - The owner address (defaults to wallet address).
|
|
1113
|
+
* @return A record mapping obligation key IDs to their names.
|
|
1114
|
+
*/
|
|
1115
|
+
getObligationNames(owner?: string): Promise<Record<string, string>>;
|
|
1197
1116
|
}
|
|
1198
1117
|
|
|
1199
1118
|
type ScallopBuilderParams = {
|
|
@@ -1201,6 +1120,7 @@ type ScallopBuilderParams = {
|
|
|
1201
1120
|
usePythPullModel?: boolean;
|
|
1202
1121
|
sponsoredFeeds?: string[];
|
|
1203
1122
|
useOnChainXOracleList?: boolean;
|
|
1123
|
+
xOracleList?: xOracleListType;
|
|
1204
1124
|
} & ScallopQueryParams;
|
|
1205
1125
|
/**
|
|
1206
1126
|
* @description
|
|
@@ -1218,6 +1138,7 @@ declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
|
1218
1138
|
readonly usePythPullModel: boolean;
|
|
1219
1139
|
readonly useOnChainXOracleList: boolean;
|
|
1220
1140
|
readonly sponsoredFeeds: string[];
|
|
1141
|
+
xOracleList?: xOracleListType;
|
|
1221
1142
|
constructor(params?: ScallopBuilderParams);
|
|
1222
1143
|
get utils(): ScallopUtils;
|
|
1223
1144
|
get constants(): ScallopConstants;
|
|
@@ -1250,8 +1171,8 @@ declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
|
1250
1171
|
*/
|
|
1251
1172
|
selectCoin(txBlock: ScallopTxBlock | SuiTxBlock, assetCoinName: string, amount: number, sender?: string, isSponsored?: boolean): Promise<{
|
|
1252
1173
|
takeCoin: {
|
|
1253
|
-
NestedResult: [number, number];
|
|
1254
1174
|
$kind: "NestedResult";
|
|
1175
|
+
NestedResult: [number, number];
|
|
1255
1176
|
};
|
|
1256
1177
|
leftCoin?: undefined;
|
|
1257
1178
|
totalAmount?: undefined;
|
|
@@ -1686,7 +1607,6 @@ declare class ScallopClient implements ScallopClientInterface {
|
|
|
1686
1607
|
withdrawCollateral(collateralCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1687
1608
|
withdrawCollateral<S extends boolean>(collateralCoinName: string, amount: number, sign?: S, obligationId?: string, obligationKey?: string, walletAddress?: string, isSponsoredTx?: boolean): Promise<ScallopClientFnReturnType<S>>;
|
|
1688
1609
|
/**
|
|
1689
|
-
* @deprecated Use {@link supply} instead.
|
|
1690
1610
|
* Deposit asset into the specific pool.
|
|
1691
1611
|
*
|
|
1692
1612
|
* @param poolCoinName - Types of pool coin.
|
|
@@ -1698,18 +1618,6 @@ declare class ScallopClient implements ScallopClientInterface {
|
|
|
1698
1618
|
deposit(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1699
1619
|
deposit<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1700
1620
|
/**
|
|
1701
|
-
* Supply asset into the specific lending pool.
|
|
1702
|
-
*
|
|
1703
|
-
* @param poolCoinName - Types of pool coin.
|
|
1704
|
-
* @param amount - The amount of coins would deposit.
|
|
1705
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1706
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1707
|
-
* @return Transaction block response or transaction block.
|
|
1708
|
-
*/
|
|
1709
|
-
supply(poolCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1710
|
-
supply<S extends boolean>(poolCoinName: string, amount: number, sign?: S, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1711
|
-
/**
|
|
1712
|
-
* @deprecated Use {@link supplyAndStake}
|
|
1713
1621
|
* Deposit asset into the specific pool and Stake market coin into the corresponding spool.
|
|
1714
1622
|
*
|
|
1715
1623
|
* @param stakeCoinName - Types of stake coin.
|
|
@@ -1722,19 +1630,7 @@ declare class ScallopClient implements ScallopClientInterface {
|
|
|
1722
1630
|
depositAndStake(stakeCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1723
1631
|
depositAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1724
1632
|
/**
|
|
1725
|
-
*
|
|
1726
|
-
*
|
|
1727
|
-
* @param stakeCoinName - Types of stake coin.
|
|
1728
|
-
* @param amount - The amount of coins would supply.
|
|
1729
|
-
* @param sign - Decide to directly sign the transaction or return the transaction block.
|
|
1730
|
-
* @param stakeAccountId - The stake account object.
|
|
1731
|
-
* @param walletAddress - The wallet address of the owner.
|
|
1732
|
-
* @return Transaction block response or transaction block.
|
|
1733
|
-
*/
|
|
1734
|
-
supplyAndStake(stakeCoinName: string, amount: number): Promise<SuiTransactionBlockResponse>;
|
|
1735
|
-
supplyAndStake<S extends boolean>(stakeCoinName: string, amount: number, sign?: S, stakeAccountId?: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
|
|
1736
|
-
/**
|
|
1737
|
-
* Withdraw asset from the specific lending pool, must return market coin.
|
|
1633
|
+
* Withdraw asset from the specific pool, must return market coin.
|
|
1738
1634
|
*
|
|
1739
1635
|
* @param poolCoinName - Specific support pool coin name.
|
|
1740
1636
|
* @param amount - The amount of coins would withdraw.
|
|
@@ -1965,8 +1861,6 @@ type CoreIds = {
|
|
|
1965
1861
|
type NestedResult = Extract<Argument, {
|
|
1966
1862
|
$kind: 'NestedResult';
|
|
1967
1863
|
}>;
|
|
1968
|
-
/** Transaction command from getData().commands (MoveCall, TransferObjects, etc.) */
|
|
1969
|
-
type TransactionCommand = ReturnType<Transaction$1['getData']>['commands'][number];
|
|
1970
1864
|
type Obligation$1 = NestedResult;
|
|
1971
1865
|
type ObligationKey = NestedResult;
|
|
1972
1866
|
type ObligationHotPotato = NestedResult;
|
|
@@ -1974,17 +1868,9 @@ type CoreNormalMethods = {
|
|
|
1974
1868
|
openObligation: () => [Obligation$1, ObligationKey, ObligationHotPotato];
|
|
1975
1869
|
returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
|
|
1976
1870
|
openObligationEntry: () => void;
|
|
1977
|
-
/**
|
|
1978
|
-
* @deprecated Use {@link depositCollateral} instead.
|
|
1979
|
-
*/
|
|
1980
1871
|
addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
|
|
1981
|
-
depositCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
|
|
1982
1872
|
takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: string) => TransactionResult;
|
|
1983
|
-
/**
|
|
1984
|
-
* @deprecated Use {@link supply} instead.
|
|
1985
|
-
*/
|
|
1986
1873
|
deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1987
|
-
supply: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1988
1874
|
depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1989
1875
|
withdraw: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1990
1876
|
withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
@@ -1997,11 +1883,7 @@ type CoreNormalMethods = {
|
|
|
1997
1883
|
liquidate: (obligation: SuiObjectArg, coin: SuiObjectArg, debtCoinName: string, collateralCoinName: string) => [NestedResult, NestedResult];
|
|
1998
1884
|
};
|
|
1999
1885
|
type CoreQuickMethods = {
|
|
2000
|
-
/**
|
|
2001
|
-
* @deprecated Use {@link depositCollateralQuick} instead.
|
|
2002
|
-
*/
|
|
2003
1886
|
addCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, isSponsoredTx?: boolean) => Promise<void>;
|
|
2004
|
-
depositCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, isSponsoredTx?: boolean) => Promise<void>;
|
|
2005
1887
|
takeCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg, updateOracleOptions?: {
|
|
2006
1888
|
usePythPullModel?: boolean;
|
|
2007
1889
|
useOnChainXOracleList?: boolean;
|
|
@@ -2020,11 +1902,7 @@ type CoreQuickMethods = {
|
|
|
2020
1902
|
sponsoredFeeds?: string[];
|
|
2021
1903
|
isSponsoredTx?: boolean;
|
|
2022
1904
|
}) => Promise<TransactionResult>;
|
|
2023
|
-
/**
|
|
2024
|
-
* @deprecated Use {@link supplyQuick} instead.
|
|
2025
|
-
*/
|
|
2026
1905
|
depositQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean, isSponsoredTx?: boolean) => Promise<TransactionResult>;
|
|
2027
|
-
supplyQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean, isSponsoredTx?: boolean) => Promise<TransactionResult>;
|
|
2028
1906
|
withdrawQuick: (amount: number, poolCoinName: string) => Promise<TransactionResult>;
|
|
2029
1907
|
repayQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg, isSponsoredTx?: boolean) => Promise<void>;
|
|
2030
1908
|
updateAssetPricesQuick: (assetCoinNames?: string[], updateOracleOptions?: {
|
|
@@ -2108,16 +1986,6 @@ type GenerateBorrowIncentiveQuickMethod = (params: {
|
|
|
2108
1986
|
txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
|
|
2109
1987
|
}) => BorrowIncentiveQuickMethods;
|
|
2110
1988
|
|
|
2111
|
-
/** Dynamic field response structure from queryGetDynamicFieldObject (subs table) - SDK v2 */
|
|
2112
|
-
type DynamicFieldResponseWithContents = {
|
|
2113
|
-
object?: {
|
|
2114
|
-
json?: {
|
|
2115
|
-
value?: {
|
|
2116
|
-
contents?: unknown[];
|
|
2117
|
-
};
|
|
2118
|
-
};
|
|
2119
|
-
};
|
|
2120
|
-
};
|
|
2121
1989
|
type VeScaNormalMethods = {
|
|
2122
1990
|
lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
|
|
2123
1991
|
extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
@@ -2198,6 +2066,7 @@ type ReferralNormalMethods = {
|
|
|
2198
2066
|
claimReferralTicket: (poolCoinName: string) => TransactionResult$1;
|
|
2199
2067
|
burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
|
|
2200
2068
|
claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: string) => TransactionResult$1;
|
|
2069
|
+
unbindReferral: () => void;
|
|
2201
2070
|
};
|
|
2202
2071
|
type ReferralQuickMethods = {
|
|
2203
2072
|
claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: string[]) => Promise<void>;
|
|
@@ -2205,6 +2074,29 @@ type ReferralQuickMethods = {
|
|
|
2205
2074
|
type SuiTxBlockWithReferralNormalMethods = SuiTxBlock & ReferralNormalMethods;
|
|
2206
2075
|
type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
|
|
2207
2076
|
|
|
2077
|
+
type ObligationNamingIds = {
|
|
2078
|
+
pkgId: string;
|
|
2079
|
+
namingRegistry: string;
|
|
2080
|
+
};
|
|
2081
|
+
type ObligationNamingNormalMethods = {
|
|
2082
|
+
setObligationName: (obligationKey: SuiObjectArg, name: string) => void;
|
|
2083
|
+
removeObligationName: (obligationKey: SuiObjectArg) => void;
|
|
2084
|
+
};
|
|
2085
|
+
type ObligationNamingQuickMethods = {
|
|
2086
|
+
setObligationNameQuick: (obligationKeyId: string, name: string) => Promise<void>;
|
|
2087
|
+
removeObligationNameQuick: (obligationKeyId: string) => Promise<void>;
|
|
2088
|
+
};
|
|
2089
|
+
type SuiTxBlockWithObligationNamingNormalMethods = SuiTxBlock & ObligationNamingNormalMethods;
|
|
2090
|
+
type ObligationNamingTxBlock = SuiTxBlockWithObligationNamingNormalMethods & ObligationNamingQuickMethods;
|
|
2091
|
+
type GenerateObligationNamingNormalMethod = (params: {
|
|
2092
|
+
builder: ScallopBuilder;
|
|
2093
|
+
txBlock: SuiTxBlock;
|
|
2094
|
+
}) => ObligationNamingNormalMethods;
|
|
2095
|
+
type GenerateObligationNamingQuickMethod = (params: {
|
|
2096
|
+
builder: ScallopBuilder;
|
|
2097
|
+
txBlock: SuiTxBlockWithObligationNamingNormalMethods;
|
|
2098
|
+
}) => ObligationNamingQuickMethods;
|
|
2099
|
+
|
|
2208
2100
|
type LoyaltyProgramNormalMethods = {
|
|
2209
2101
|
claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
2210
2102
|
claimVeScaLoyaltyReward: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
@@ -2258,7 +2150,7 @@ type GenerateSCoinQuickMethod = (params: {
|
|
|
2258
2150
|
txBlock: SuiTxBlockWithSCoinNormalMethods;
|
|
2259
2151
|
}) => sCoinQuickMethods;
|
|
2260
2152
|
|
|
2261
|
-
type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
2153
|
+
type BaseScallopTxBlock = ReferralTxBlock & ObligationNamingTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
2262
2154
|
type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
2263
2155
|
type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
2264
2156
|
type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
@@ -2512,7 +2404,9 @@ type BalanceSheet = {
|
|
|
2512
2404
|
type BorrowDynamic = {
|
|
2513
2405
|
borrow_index: string;
|
|
2514
2406
|
interest_rate: {
|
|
2515
|
-
|
|
2407
|
+
fields: {
|
|
2408
|
+
value: string;
|
|
2409
|
+
};
|
|
2516
2410
|
};
|
|
2517
2411
|
interest_rate_scale: string;
|
|
2518
2412
|
last_updated: string;
|
|
@@ -2522,57 +2416,89 @@ type BorrowFee = {
|
|
|
2522
2416
|
};
|
|
2523
2417
|
type InterestModel = {
|
|
2524
2418
|
base_borrow_rate_per_sec: {
|
|
2525
|
-
|
|
2419
|
+
fields: {
|
|
2420
|
+
value: string;
|
|
2421
|
+
};
|
|
2526
2422
|
};
|
|
2527
2423
|
borrow_rate_on_high_kink: {
|
|
2528
|
-
|
|
2424
|
+
fields: {
|
|
2425
|
+
value: string;
|
|
2426
|
+
};
|
|
2529
2427
|
};
|
|
2530
2428
|
borrow_rate_on_mid_kink: {
|
|
2531
|
-
|
|
2429
|
+
fields: {
|
|
2430
|
+
value: string;
|
|
2431
|
+
};
|
|
2532
2432
|
};
|
|
2533
2433
|
borrow_weight: {
|
|
2534
|
-
|
|
2434
|
+
fields: {
|
|
2435
|
+
value: string;
|
|
2436
|
+
};
|
|
2535
2437
|
};
|
|
2536
2438
|
borrow_fee_rate: {
|
|
2537
|
-
|
|
2439
|
+
fields: {
|
|
2440
|
+
value: string;
|
|
2441
|
+
};
|
|
2538
2442
|
};
|
|
2539
2443
|
high_kink: {
|
|
2540
|
-
|
|
2444
|
+
fields: {
|
|
2445
|
+
value: string;
|
|
2446
|
+
};
|
|
2541
2447
|
};
|
|
2542
2448
|
interest_rate_scale: string;
|
|
2543
2449
|
max_borrow_rate: {
|
|
2544
|
-
|
|
2450
|
+
fields: {
|
|
2451
|
+
value: string;
|
|
2452
|
+
};
|
|
2545
2453
|
};
|
|
2546
2454
|
mid_kink: {
|
|
2547
|
-
|
|
2455
|
+
fields: {
|
|
2456
|
+
value: string;
|
|
2457
|
+
};
|
|
2548
2458
|
};
|
|
2549
2459
|
min_borrow_amount: string;
|
|
2550
2460
|
revenue_factor: {
|
|
2551
|
-
|
|
2461
|
+
fields: {
|
|
2462
|
+
value: string;
|
|
2463
|
+
};
|
|
2552
2464
|
};
|
|
2553
2465
|
type: {
|
|
2554
|
-
|
|
2466
|
+
fields: {
|
|
2467
|
+
name: string;
|
|
2468
|
+
};
|
|
2555
2469
|
};
|
|
2556
2470
|
};
|
|
2557
2471
|
type RiskModel = {
|
|
2558
2472
|
collateral_factor: {
|
|
2559
|
-
|
|
2473
|
+
fields: {
|
|
2474
|
+
value: string;
|
|
2475
|
+
};
|
|
2560
2476
|
};
|
|
2561
2477
|
liquidation_discount: {
|
|
2562
|
-
|
|
2478
|
+
fields: {
|
|
2479
|
+
value: string;
|
|
2480
|
+
};
|
|
2563
2481
|
};
|
|
2564
2482
|
liquidation_factor: {
|
|
2565
|
-
|
|
2483
|
+
fields: {
|
|
2484
|
+
value: string;
|
|
2485
|
+
};
|
|
2566
2486
|
};
|
|
2567
2487
|
liquidation_penalty: {
|
|
2568
|
-
|
|
2488
|
+
fields: {
|
|
2489
|
+
value: string;
|
|
2490
|
+
};
|
|
2569
2491
|
};
|
|
2570
2492
|
liquidation_revenue_factor: {
|
|
2571
|
-
|
|
2493
|
+
fields: {
|
|
2494
|
+
value: string;
|
|
2495
|
+
};
|
|
2572
2496
|
};
|
|
2573
2497
|
max_collateral_amount: string;
|
|
2574
2498
|
type: {
|
|
2575
|
-
|
|
2499
|
+
fields: {
|
|
2500
|
+
name: string;
|
|
2501
|
+
};
|
|
2576
2502
|
};
|
|
2577
2503
|
};
|
|
2578
2504
|
type CollateralStat = {
|
|
@@ -2871,7 +2797,9 @@ type Spool = {
|
|
|
2871
2797
|
} & Required<Pick<ParsedSpoolData, 'maxPoint' | 'distributedPoint' | 'maxStake'>> & CalculatedSpoolData & SpoolRewardPool;
|
|
2872
2798
|
type OriginSpoolData = {
|
|
2873
2799
|
stakeType: {
|
|
2874
|
-
|
|
2800
|
+
fields: {
|
|
2801
|
+
name: string;
|
|
2802
|
+
};
|
|
2875
2803
|
};
|
|
2876
2804
|
maxDistributedPoint: string;
|
|
2877
2805
|
distributedPoint: string;
|
|
@@ -2896,7 +2824,10 @@ type SpoolData = {
|
|
|
2896
2824
|
max_stakes: string;
|
|
2897
2825
|
point_distribution_time: string;
|
|
2898
2826
|
stake_type: {
|
|
2899
|
-
|
|
2827
|
+
type: string;
|
|
2828
|
+
fields: {
|
|
2829
|
+
name: string;
|
|
2830
|
+
};
|
|
2900
2831
|
};
|
|
2901
2832
|
stakes: string;
|
|
2902
2833
|
};
|
|
@@ -3125,7 +3056,9 @@ type VeScaTreasuryFields = {
|
|
|
3125
3056
|
total_ve_sca_amount: string;
|
|
3126
3057
|
sca_balance: string;
|
|
3127
3058
|
unlock_schedule: {
|
|
3128
|
-
|
|
3059
|
+
fields: {
|
|
3060
|
+
locked_sca_amount: string;
|
|
3061
|
+
};
|
|
3129
3062
|
};
|
|
3130
3063
|
};
|
|
3131
3064
|
type VeScaTreasuryInfo = {
|
|
@@ -3248,6 +3181,10 @@ interface AddressesInterface {
|
|
|
3248
3181
|
veScaRewardPool: string;
|
|
3249
3182
|
veScaRewardTableId: string;
|
|
3250
3183
|
};
|
|
3184
|
+
obligationNaming?: {
|
|
3185
|
+
id: string;
|
|
3186
|
+
namingRegistry: string;
|
|
3187
|
+
};
|
|
3251
3188
|
scoin: {
|
|
3252
3189
|
id: string;
|
|
3253
3190
|
coins: Partial<Record<string, {
|
|
@@ -3463,4 +3400,4 @@ declare const MIN_TOP_UP_AMOUNT: 1000000000;
|
|
|
3463
3400
|
|
|
3464
3401
|
declare const xOracleList: xOracleListType;
|
|
3465
3402
|
|
|
3466
|
-
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type
|
|
3403
|
+
export { API_BASE_URL, type AddressStringPath, type AddressesInterface, type AssetCoinIds, type AssetCoins, type BalanceSheet, type BaseScallopTxBlock, type BorrowDynamic, type BorrowFee, type BorrowIncentiveAccountKey, type BorrowIncentiveAccounts, type BorrowIncentiveAccountsQueryInterface, type BorrowIncentiveIds, type BorrowIncentiveNormalMethods, type BorrowIncentivePool, type BorrowIncentivePoolPoints, type BorrowIncentivePools, type BorrowIncentivePoolsQueryInterface, type BorrowIncentiveQuickMethods, type BorrowIncentiveRewardCoins, type BorrowIncentiveTxBlock, type CalculatedBorrowIncentivePoolPointData, type CalculatedMarketCollateralData, type CalculatedMarketPoolData, type CalculatedSpoolData, type CalculatedSpoolRewardPoolData, type CoinAmounts, type CoinPrices, type CoinWrappedType, type Coins, type CollateralStat, type CoreIds, type CoreNormalMethods, type CoreQuickMethods, type CoreTxBlock, DEFAULT_CACHE_OPTIONS, type GenerateBorrowIncentiveNormalMethod, type GenerateBorrowIncentiveQuickMethod, type GenerateCoreNormalMethod, type GenerateCoreQuickMethod, type GenerateLoyaltyProgramNormalMethod, type GenerateLoyaltyProgramQuickMethod, type GenerateObligationNamingNormalMethod, type GenerateObligationNamingQuickMethod, type GenerateSCoinNormalMethod, type GenerateSCoinQuickMethod, type GenerateSpoolNormalMethod, type GenerateSpoolQuickMethod, type GenerateVeScaNormalMethod, type GenerateVeScaQuickMethod, IS_VE_SCA_TEST, type InterestModel, type Lending, type Lendings, type LoyaltyProgramInfo, type LoyaltyProgramNormalMethods, type LoyaltyProgramQuickMethods, type LoyaltyProgramTxBlock, MAX_LOCK_DURATION, MAX_LOCK_ROUNDS, MIN_INITIAL_LOCK_AMOUNT, MIN_TOP_UP_AMOUNT, type Market, type MarketCoinAmounts, type MarketCoins, type MarketCollateral, type MarketCollaterals, type MarketPool, type MarketPools, type MarketQueryInterface, type NestedResult, OLD_BORROW_INCENTIVE_PROTOCOL_ID, type Obligation, type ObligationAccount, type ObligationAccounts, type ObligationBorrowIncentive, type ObligationBorrowIncentiveReward, type ObligationCollateral, type ObligationDebt, type ObligationNamingIds, type ObligationNamingNormalMethods, type ObligationNamingQuickMethods, type ObligationNamingTxBlock, type ObligationQueryInterface, type OptionalKeys, type OriginBorrowIncentiveAccountData, type OriginBorrowIncentiveAccountPoolData, type OriginBorrowIncentivePoolData, type OriginBorrowIncentivePoolPointData, type OriginMarketCollateralData, type OriginMarketPoolData, type OriginSpoolData, type OriginSpoolRewardPoolData, POOL_ADDRESSES, type ParsedBorrowIncentiveAccountData, type ParsedBorrowIncentiveAccountPoolData, type ParsedBorrowIncentivePoolData, type ParsedBorrowIncentivePoolPointData, type ParsedMarketCollateralData, type ParsedMarketPoolData, type ParsedSpoolData, type ParsedSpoolRewardPoolData, type PoolAddress, type QuickMethodReturnType, RPC_PROVIDERS, type RiskModel, SCA_COIN_TYPE, type SCoinAmounts, type SCoinConverterTreasury, type SCoinIds, type SCoinTreasuryCaps, type SCoinTxBlock, type SCoins, SDK_API_BASE_URL, Scallop, ScallopAddress, ScallopBuilder, ScallopClient, ScallopConstants, ScallopIndexer, ScallopQuery, ScallopSuiKit, type ScallopTxBlock, ScallopUtils, type Spool, type SpoolData, type SpoolIds, type SpoolNormalMethods, type SpoolQuickMethods, type SpoolRewardPool, type SpoolTxBlock, type Spools, type StakeAccount, type StakeAccounts, type StakeMarketCoins, type StakePool, type StakePools, type StakeRewardCoins, type StakeRewardPool, type StakeRewardPools, type SuiBridgeCoins, type SuiBridgedCoinPackageIds, type SuiTxBlockWithBorrowIncentiveNormalMethods, type SuiTxBlockWithCoreNormalMethods, type SuiTxBlockWithLoyaltyProgramNormalMethods, type SuiTxBlockWithObligationNamingNormalMethods, type SuiTxBlockWithSCoin, type SuiTxBlockWithSCoinNormalMethods, type SuiTxBlockWithSpool, type SuiTxBlockWithSpoolNormalMethods, type SuiTxBlockWithVeScaNormalMethods, type SupportOracleType, TEST_ADDRESSES, type TotalValueLocked, UNLOCK_ROUND_DURATION, USE_TEST_ADDRESS, type VeScaLoyaltyProgramInfo, type VeScaNormalMethods, type VeScaQuickMethods, type VeScaTreasuryFields, type VeScaTreasuryInfo, type VeScaTxBlock, type Vesca, type VoloCoinIds, WHITELIST, type Whitelist, type WormholeCoinIds, _SUPPORT_ORACLES, queryKeys, type sCoinBalance, type sCoinNormalMethods, type sCoinPkgIds, type sCoinQuickMethods, xOracleList, type xOracleListType, type xOracleRuleType, type xOracleRules };
|