@scallop-io/sui-scallop-sdk 1.3.4-alpha.6 → 1.3.4-alpha.7
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/builders/borrowIncentiveBuilder.d.ts +12 -0
- package/dist/builders/coreBuilder.d.ts +12 -0
- package/dist/builders/index.d.ts +12 -0
- package/dist/builders/loyaltyProgramBuilder.d.ts +12 -0
- package/dist/builders/oracle.d.ts +14 -0
- package/dist/builders/referralBuilder.d.ts +12 -0
- package/dist/builders/sCoinBuilder.d.ts +4 -0
- package/dist/builders/spoolBuilder.d.ts +12 -0
- package/dist/builders/vescaBuilder.d.ts +25 -0
- package/dist/constants/cache.d.ts +14 -0
- package/dist/constants/coinGecko.d.ts +2 -0
- package/dist/constants/common.d.ts +20 -0
- package/dist/constants/enum.d.ts +14 -0
- package/dist/constants/flashloan.d.ts +2 -0
- package/dist/constants/index.d.ts +12 -0
- package/dist/constants/poolAddress.d.ts +5 -0
- package/dist/constants/pyth.d.ts +5 -0
- package/dist/constants/queryKeys.d.ts +56 -0
- package/dist/constants/rpc.d.ts +1 -0
- package/dist/constants/testAddress.d.ts +2 -0
- package/dist/constants/tokenBucket.d.ts +2 -0
- package/dist/constants/vesca.d.ts +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/scallop.d.ts +74 -0
- package/dist/models/scallopAddress.d.ts +150 -0
- package/dist/models/scallopBuilder.d.ts +89 -0
- package/dist/models/scallopCache.d.ts +74 -0
- package/dist/models/scallopClient.d.ts +321 -0
- package/dist/models/scallopIndexer.d.ts +89 -0
- package/dist/models/scallopQuery.d.ts +489 -0
- package/dist/models/scallopUtils.d.ts +227 -0
- package/dist/models/suiKit.d.ts +2 -0
- package/dist/queries/borrowIncentiveQuery.d.ts +61 -0
- package/dist/queries/coreQuery.d.ts +167 -0
- package/dist/queries/index.d.ts +11 -0
- package/dist/queries/isolatedAssetQuery.d.ts +14 -0
- package/dist/queries/loyaltyProgramQuery.d.ts +10 -0
- package/dist/queries/portfolioQuery.d.ts +73 -0
- package/dist/queries/priceQuery.d.ts +16 -0
- package/dist/queries/referralQuery.d.ts +7 -0
- package/dist/queries/sCoinQuery.d.ts +41 -0
- package/dist/queries/spoolQuery.d.ts +70 -0
- package/dist/queries/supplyLimitQuery.d.ts +9 -0
- package/dist/queries/vescaQuery.d.ts +36 -0
- package/dist/types/address.d.ts +107 -0
- package/dist/types/builder/borrowIncentive.d.ts +35 -0
- package/dist/types/builder/core.d.ts +56 -0
- package/dist/types/builder/index.d.ts +24 -0
- package/dist/types/builder/loyaltyProgram.d.ts +23 -0
- package/dist/types/builder/referral.d.ts +30 -0
- package/dist/types/builder/sCoin.d.ts +37 -0
- package/dist/types/builder/spool.d.ts +29 -0
- package/dist/types/builder/vesca.d.ts +51 -0
- package/dist/types/constant/common.d.ts +24 -0
- package/dist/types/constant/enum.d.ts +48 -0
- package/dist/types/constant/index.d.ts +2 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/model.d.ts +54 -0
- package/dist/types/query/borrowIncentive.d.ts +124 -0
- package/dist/types/query/core.d.ts +361 -0
- package/dist/types/query/index.d.ts +7 -0
- package/dist/types/query/loyaltyProgram.d.ts +5 -0
- package/dist/types/query/portfolio.d.ts +115 -0
- package/dist/types/query/sCoin.d.ts +1 -0
- package/dist/types/query/spool.d.ts +122 -0
- package/dist/types/query/vesca.d.ts +26 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/utils/builder.d.ts +15 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/indexer.d.ts +17 -0
- package/dist/utils/query.d.ts +62 -0
- package/dist/utils/tokenBucket.d.ts +11 -0
- package/dist/utils/util.d.ts +26 -0
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
|
+
import type { ScallopBuilder } from 'src/models';
|
|
4
|
+
import type { BorrowIncentiveTxBlock, ScallopTxBlock } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Create an enhanced transaction block instance for interaction with borrow incentive modules of the Scallop contract.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return Scallop borrow incentive txBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newBorrowIncentiveTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => BorrowIncentiveTxBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
|
+
import type { ScallopBuilder } from '../models';
|
|
4
|
+
import type { CoreTxBlock, ScallopTxBlock, SuiTxBlockWithSpool } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Create an enhanced transaction block instance for interaction with core modules of the Scallop contract.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return Scallop core txBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newCoreTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | SuiTxBlockWithSpool) => CoreTxBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
|
+
import type { ScallopBuilder } from '../models';
|
|
4
|
+
import type { ScallopTxBlock } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Create a new ScallopTxBlock instance.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return ScallopTxBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newScallopTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => ScallopTxBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
|
+
import { ScallopBuilder } from 'src/models';
|
|
4
|
+
import { LoyaltyProgramTxBlock, ScallopTxBlock } from 'src/types';
|
|
5
|
+
/**
|
|
6
|
+
* Create an enhanced transaction block instance for interaction with loyalty program modules of the Scallop contract.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return Scallop loyalty program txBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newLoyaltyProgramTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => LoyaltyProgramTxBlock;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
2
|
+
import type { ScallopBuilder } from '../models';
|
|
3
|
+
import type { SupportAssetCoins } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Update the price of the oracle for multiple coin.
|
|
6
|
+
*
|
|
7
|
+
* @param builder - The scallop builder.
|
|
8
|
+
* @param txBlock - TxBlock created by SuiKit.
|
|
9
|
+
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
10
|
+
* @param options - The options for update oracles.
|
|
11
|
+
*/
|
|
12
|
+
export declare const updateOracles: (builder: ScallopBuilder, txBlock: SuiKitTxBlock, assetCoinNames?: SupportAssetCoins[], options?: {
|
|
13
|
+
usePythPullModel: boolean;
|
|
14
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScallopBuilder } from 'src/models';
|
|
2
|
+
import { ScallopTxBlock } from 'src/types';
|
|
3
|
+
import { SuiTxBlock as SuiKitTxBlock, Transaction } from '@scallop-io/sui-kit';
|
|
4
|
+
import { ReferralTxBlock } from 'src/types/builder/referral';
|
|
5
|
+
/**
|
|
6
|
+
* Create an enhanced transaction block instance for interaction with borrow incentive modules of the Scallop contract.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return Scallop referral txBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newReferralTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => ReferralTxBlock;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Transaction, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
2
|
+
import { ScallopBuilder } from 'src/models';
|
|
3
|
+
import { BaseScallopTxBlock, SCoinTxBlock, ScallopTxBlock } from 'src/types';
|
|
4
|
+
export declare const newSCoinTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | BaseScallopTxBlock) => SCoinTxBlock;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
2
|
+
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
|
+
import type { ScallopBuilder } from '../models';
|
|
4
|
+
import type { SpoolTxBlock, ScallopTxBlock, SuiTxBlockWithSCoin } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Create an enhanced transaction block instance for interaction with spool modules of the Scallop contract.
|
|
7
|
+
*
|
|
8
|
+
* @param builder - Scallop builder instance.
|
|
9
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
10
|
+
* @return Scallop spool txBlock.
|
|
11
|
+
*/
|
|
12
|
+
export declare const newSpoolTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction | SuiTxBlockWithSCoin) => SpoolTxBlock;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SuiTxBlock, Transaction, SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
2
|
+
import { ScallopBuilder } from '../models';
|
|
3
|
+
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
4
|
+
import type { ScallopTxBlock, VeScaTxBlock } from 'src/types';
|
|
5
|
+
/**
|
|
6
|
+
* Check and get veSCA data from transaction block.
|
|
7
|
+
*
|
|
8
|
+
* @description
|
|
9
|
+
* If the veScaKey id is provided, directly return it.
|
|
10
|
+
* Otherwise, automatically get veScaKey from the sender.
|
|
11
|
+
*
|
|
12
|
+
* @param builder - Scallop builder instance.
|
|
13
|
+
* @param txBlock - TxBlock created by SuiKit.
|
|
14
|
+
* @param veScaKey - veSCA key.
|
|
15
|
+
* @return veSCA key, ID, locked amount and unlock at timestamp.
|
|
16
|
+
*/
|
|
17
|
+
export declare const requireVeSca: (builder: ScallopBuilder, SuiTxBlock: SuiTxBlock, veScaKey?: SuiObjectArg | undefined) => Promise<import("src/types").Vesca | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Create an enhanced transaction block instance for interaction with veSCA modules of the Scallop contract.
|
|
20
|
+
*
|
|
21
|
+
* @param builder - Scallop builder instance.
|
|
22
|
+
* @param initTxBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
23
|
+
* @return Scallop borrow incentive txBlock.
|
|
24
|
+
*/
|
|
25
|
+
export declare const newVeScaTxBlock: (builder: ScallopBuilder, initTxBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction) => VeScaTxBlock;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default cache options for the QueryClient.
|
|
3
|
+
* @type {QueryClientConfig}
|
|
4
|
+
* @description Default cache options for the QueryClient
|
|
5
|
+
* We set the default to 5s to prevent duplicate requests from being requested (e.g. query MarketObject, etc.)
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_CACHE_OPTIONS: {
|
|
8
|
+
defaultOptions: {
|
|
9
|
+
queries: {
|
|
10
|
+
staleTime: number;
|
|
11
|
+
gcTime: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const API_BASE_URL: "https://sui.apis.scallop.io";
|
|
2
|
+
export declare const SDK_API_BASE_URL: "https://sdk.api.scallop.io";
|
|
3
|
+
export declare const IS_VE_SCA_TEST: boolean;
|
|
4
|
+
export declare const USE_TEST_ADDRESS: boolean;
|
|
5
|
+
export declare const ADDRESSES_ID: "65fb07c39c845425d71d7b18" | "66f8e7ed9bb9e07fdfb86bbb";
|
|
6
|
+
export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
|
|
7
|
+
export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
8
|
+
export declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
9
|
+
export declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
10
|
+
export declare const SUPPORT_POOLS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
11
|
+
export declare const SUPPORT_COLLATERALS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
12
|
+
export declare const SUPPORT_SPOOLS: readonly ["susdc", "sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
|
|
13
|
+
export declare const SUPPORT_SCOIN: readonly ["susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
|
|
14
|
+
export declare const SUPPORT_SUI_BRIDGE: readonly ["sbeth"];
|
|
15
|
+
export declare const SUPPORT_WORMHOLE: readonly ["wusdc", "wusdt", "weth", "wbtc", "wapt", "wsol"];
|
|
16
|
+
export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
|
|
17
|
+
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sbeth", "sca", "usdc"];
|
|
18
|
+
export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui", "sca"];
|
|
19
|
+
export declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
20
|
+
export declare const SUPPORT_PACKAGES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as types from '../types';
|
|
2
|
+
export declare const coinDecimals: types.SupportCoinDecimals;
|
|
3
|
+
export declare const assetCoins: types.AssetCoins;
|
|
4
|
+
export declare const marketCoins: types.MarketCoins;
|
|
5
|
+
export declare const sCoins: types.SCoins;
|
|
6
|
+
export declare const stakeMarketCoins: types.StakeMarketCoins;
|
|
7
|
+
export declare const spoolRewardCoins: types.StakeRewardCoins;
|
|
8
|
+
export declare const suiBridgeCoins: types.SuiBridgeCoins;
|
|
9
|
+
export declare const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins;
|
|
10
|
+
export declare const coinIds: types.AssetCoinIds;
|
|
11
|
+
export declare const wormholeCoinIds: types.WormholeCoinIds;
|
|
12
|
+
export declare const voloCoinIds: types.VoloCoinIds;
|
|
13
|
+
export declare const sCoinIds: types.SCoinIds;
|
|
14
|
+
export declare const sCoinTypeToName: Record<string, "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './cache';
|
|
2
|
+
export * from './coinGecko';
|
|
3
|
+
export * from './common';
|
|
4
|
+
export * from './enum';
|
|
5
|
+
export * from './flashloan';
|
|
6
|
+
export * from './poolAddress';
|
|
7
|
+
export * from './pyth';
|
|
8
|
+
export * from './queryKeys';
|
|
9
|
+
export * from './rpc';
|
|
10
|
+
export * from './testAddress';
|
|
11
|
+
export * from './tokenBucket';
|
|
12
|
+
export * from './vesca';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { GetDynamicFieldObjectParams, GetDynamicFieldsParams, GetOwnedObjectsParams, SuiObjectData, SuiObjectDataOptions } from '@mysten/sui/client';
|
|
2
|
+
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
3
|
+
export declare const queryKeys: {
|
|
4
|
+
api: {
|
|
5
|
+
getAddresses: (addressesId?: string) => (string | {
|
|
6
|
+
addressesId: string | undefined;
|
|
7
|
+
})[];
|
|
8
|
+
getMarket: () => string[];
|
|
9
|
+
getSpools: () => string[];
|
|
10
|
+
getBorrowIncentivePool: () => string[];
|
|
11
|
+
getTotalValueLocked: () => string[];
|
|
12
|
+
};
|
|
13
|
+
rpc: {
|
|
14
|
+
getInspectTxn: (queryTarget?: string, args?: SuiObjectArg[], typeArgs?: any[]) => (string | {
|
|
15
|
+
queryTarget: string | undefined;
|
|
16
|
+
args: string;
|
|
17
|
+
typeArgs: string | undefined;
|
|
18
|
+
})[];
|
|
19
|
+
getObject: (objectId?: string, walletAddress?: string, options?: SuiObjectDataOptions) => (string | {
|
|
20
|
+
walletAddress: string | undefined;
|
|
21
|
+
options: SuiObjectDataOptions | undefined;
|
|
22
|
+
objectId: string | undefined;
|
|
23
|
+
})[];
|
|
24
|
+
getObjects: (objectIds?: string[], walletAddress?: string, options?: SuiObjectDataOptions) => (string | {
|
|
25
|
+
walletAddress: string | undefined;
|
|
26
|
+
options: SuiObjectDataOptions | undefined;
|
|
27
|
+
objectIds: string;
|
|
28
|
+
})[];
|
|
29
|
+
getOwnedObjects: (input?: Partial<GetOwnedObjectsParams>) => (string | {
|
|
30
|
+
walletAddress: string | undefined;
|
|
31
|
+
cursor: string | undefined;
|
|
32
|
+
options: SuiObjectDataOptions | undefined;
|
|
33
|
+
filter: string;
|
|
34
|
+
limit: number | undefined;
|
|
35
|
+
})[];
|
|
36
|
+
getDynamicFields: (input?: Partial<GetDynamicFieldsParams>) => (string | {
|
|
37
|
+
parentId: string | undefined;
|
|
38
|
+
cursor: string | undefined;
|
|
39
|
+
limit: number | undefined;
|
|
40
|
+
})[];
|
|
41
|
+
getDynamicFieldObject: (input?: Partial<GetDynamicFieldObjectParams>) => (string | {
|
|
42
|
+
parentId: string | undefined;
|
|
43
|
+
name: string;
|
|
44
|
+
})[];
|
|
45
|
+
getTotalVeScaTreasuryAmount: (refreshArgs?: any[], vescaAmountArgs?: (string | SuiObjectData)[]) => (string | {
|
|
46
|
+
refreshArgs: string;
|
|
47
|
+
vescaAmountArgs: string;
|
|
48
|
+
})[];
|
|
49
|
+
getAllCoinBalances: (owner?: string) => (string | {
|
|
50
|
+
owner: string | undefined;
|
|
51
|
+
})[];
|
|
52
|
+
};
|
|
53
|
+
oracle: {
|
|
54
|
+
getPythLatestPriceFeeds: () => string[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RPC_PROVIDERS: string[];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './scallop';
|
|
2
|
+
export * from './scallopAddress';
|
|
3
|
+
export * from './scallopClient';
|
|
4
|
+
export * from './scallopBuilder';
|
|
5
|
+
export * from './scallopQuery';
|
|
6
|
+
export * from './scallopUtils';
|
|
7
|
+
export * from './scallopIndexer';
|
|
8
|
+
export * from './scallopCache';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SuiKit } from '@scallop-io/sui-kit';
|
|
2
|
+
import { ScallopAddress } from './scallopAddress';
|
|
3
|
+
import { ScallopClient } from './scallopClient';
|
|
4
|
+
import { ScallopBuilder } from './scallopBuilder';
|
|
5
|
+
import { ScallopQuery } from './scallopQuery';
|
|
6
|
+
import { ScallopUtils } from './scallopUtils';
|
|
7
|
+
import type { ScallopBuilderParams, ScallopClientParams, ScallopParams, ScallopQueryParams, ScallopUtilsParams } from '../types/';
|
|
8
|
+
import { ScallopIndexer } from './scallopIndexer';
|
|
9
|
+
import { ScallopCache } from './scallopCache';
|
|
10
|
+
import { QueryClientConfig } from '@tanstack/query-core';
|
|
11
|
+
import { TokenBucket } from 'src/utils';
|
|
12
|
+
import type { QueryClient } from '@tanstack/query-core';
|
|
13
|
+
/**
|
|
14
|
+
* @argument params - The parameters for the Scallop instance.
|
|
15
|
+
* @argument cacheOptions - The cache options for the QueryClient.
|
|
16
|
+
*
|
|
17
|
+
* @description
|
|
18
|
+
* The main instance that controls interaction with the Scallop contract.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const sdk = new Scallop(<parameters>);
|
|
23
|
+
* const scallopAddress = await sdk.getScallopAddress();
|
|
24
|
+
* const scallopBuilder = await sdk.createScallopBuilder();
|
|
25
|
+
* const scallopClient = await sdk.createScallopClient();
|
|
26
|
+
* const scallopIndexer= await sdk.createScallopIndexer();
|
|
27
|
+
* const scallopUtils= await sdk.createScallopUtils();
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare class Scallop {
|
|
31
|
+
params: ScallopParams;
|
|
32
|
+
suiKit: SuiKit;
|
|
33
|
+
cache: ScallopCache;
|
|
34
|
+
private address;
|
|
35
|
+
constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
|
|
36
|
+
/**
|
|
37
|
+
* Get a scallop address instance that already has read addresses.
|
|
38
|
+
*
|
|
39
|
+
* @param id - The API id of the addresses.
|
|
40
|
+
* @return Scallop Address.
|
|
41
|
+
*/
|
|
42
|
+
getScallopAddress(id?: string): Promise<ScallopAddress>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a scallop builder instance that already has initial data.
|
|
45
|
+
*
|
|
46
|
+
* @return Scallop Builder.
|
|
47
|
+
*/
|
|
48
|
+
createScallopBuilder(params?: ScallopBuilderParams): Promise<ScallopBuilder>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a scallop client instance that already has initial data.
|
|
51
|
+
*
|
|
52
|
+
* @param walletAddress - When user cannot provide a secret key or mnemonic, the scallop client cannot directly derive the address of the transaction the user wants to sign. This argument specifies the wallet address for signing the transaction.
|
|
53
|
+
* @return Scallop Client.
|
|
54
|
+
*/
|
|
55
|
+
createScallopClient(params?: ScallopClientParams): Promise<ScallopClient>;
|
|
56
|
+
/**
|
|
57
|
+
* Create a scallop query instance.
|
|
58
|
+
*
|
|
59
|
+
* @return Scallop Query.
|
|
60
|
+
*/
|
|
61
|
+
createScallopQuery(params?: ScallopQueryParams): Promise<ScallopQuery>;
|
|
62
|
+
/**
|
|
63
|
+
* Create a scallop indexer instance.
|
|
64
|
+
*
|
|
65
|
+
* @return Scallop Indexer.
|
|
66
|
+
*/
|
|
67
|
+
createScallopIndexer(): Promise<ScallopIndexer>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a scallop utils instance.
|
|
70
|
+
*
|
|
71
|
+
* @return Scallop Utils.
|
|
72
|
+
*/
|
|
73
|
+
createScallopUtils(params?: ScallopUtilsParams): Promise<ScallopUtils>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type NetworkType } from '@scallop-io/sui-kit';
|
|
2
|
+
import type { ScallopAddressParams, AddressesInterface, AddressStringPath, ScallopAddressInstanceParams } from '../types';
|
|
3
|
+
import { ScallopCache } from './scallopCache';
|
|
4
|
+
/**
|
|
5
|
+
* @description
|
|
6
|
+
* It provides methods for managing addresses.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const scallopAddress = new ScallopAddress(<parameters>);
|
|
11
|
+
* scallopAddress.<address functions>();
|
|
12
|
+
* await scallopAddress.<address async functions>();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class ScallopAddress {
|
|
16
|
+
private readonly _auth?;
|
|
17
|
+
private readonly _requestClient;
|
|
18
|
+
private _id?;
|
|
19
|
+
private _network;
|
|
20
|
+
private _currentAddresses?;
|
|
21
|
+
private _addressesMap;
|
|
22
|
+
cache: ScallopCache;
|
|
23
|
+
constructor(params: ScallopAddressParams, instance?: ScallopAddressInstanceParams);
|
|
24
|
+
/**
|
|
25
|
+
* Get addresses API id.
|
|
26
|
+
*
|
|
27
|
+
* @return The addresses API id.
|
|
28
|
+
*/
|
|
29
|
+
getId(): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Get the address at the provided path.
|
|
32
|
+
*
|
|
33
|
+
* @param path - The path of the address to get.
|
|
34
|
+
* @return The address at the provided path.
|
|
35
|
+
*/
|
|
36
|
+
get(path: AddressStringPath): any;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the address for the specified path, it does not interact with the API.
|
|
39
|
+
*
|
|
40
|
+
* @param path - The path of the address to set.
|
|
41
|
+
* @param address - The address be setted to the tartget path.
|
|
42
|
+
* @return The addresses.
|
|
43
|
+
*/
|
|
44
|
+
set(path: AddressStringPath, address: string): AddressesInterface | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Synchronize the specified network addresses from the addresses map to the
|
|
47
|
+
* current addresses and change the default network to specified network.
|
|
48
|
+
*
|
|
49
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
50
|
+
* @return Current addresses.
|
|
51
|
+
*/
|
|
52
|
+
switchCurrentAddresses(network: NetworkType): AddressesInterface | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Get the addresses, If `network` is not provided, returns the current
|
|
55
|
+
* addresses or the default network addresses in the addresses map.
|
|
56
|
+
*
|
|
57
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
58
|
+
*/
|
|
59
|
+
getAddresses(network?: NetworkType): AddressesInterface | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Set the addresses into addresses map. If the specified network is the same
|
|
62
|
+
* as the current network, the current addresses will be updated at the same time.
|
|
63
|
+
*
|
|
64
|
+
* @param addresses - The addresses be setted to the tartget network.
|
|
65
|
+
* @param network - Specifies which network's addresses you want to set.
|
|
66
|
+
* @return The addresses.
|
|
67
|
+
*/
|
|
68
|
+
setAddresses(addresses: AddressesInterface, network?: NetworkType): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get all addresses.
|
|
71
|
+
*
|
|
72
|
+
* @return All addresses.
|
|
73
|
+
*/
|
|
74
|
+
getAllAddresses(): {
|
|
75
|
+
[k: string]: AddressesInterface;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Create a new addresses through the API and synchronize it back to the
|
|
79
|
+
* instance.
|
|
80
|
+
*
|
|
81
|
+
* @description
|
|
82
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
83
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
84
|
+
* all empty strings is created by default.
|
|
85
|
+
*
|
|
86
|
+
* This function only allows for one addresses to be input into a specific network
|
|
87
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
88
|
+
* across all networks at once.
|
|
89
|
+
*
|
|
90
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
91
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
92
|
+
* @param params.auth - The authentication API key.
|
|
93
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
94
|
+
* @return All addresses.
|
|
95
|
+
*/
|
|
96
|
+
create(params?: {
|
|
97
|
+
addresses?: AddressesInterface | undefined;
|
|
98
|
+
network?: NetworkType | undefined;
|
|
99
|
+
auth?: string | undefined;
|
|
100
|
+
memo?: string | undefined;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
[k: string]: AddressesInterface;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Read and synchronizes all addresses from the API into instance.
|
|
106
|
+
*
|
|
107
|
+
* @param id - The id of the addresses to get.
|
|
108
|
+
* @return All addresses.
|
|
109
|
+
*/
|
|
110
|
+
read(id?: string): Promise<{
|
|
111
|
+
[k: string]: AddressesInterface;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Update the addresses through the API and synchronize it back to the
|
|
115
|
+
* instance.
|
|
116
|
+
*
|
|
117
|
+
* @description
|
|
118
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
119
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
120
|
+
* all empty strings is created by default.
|
|
121
|
+
*
|
|
122
|
+
* This function only allows for one addresses to be input into a specific network
|
|
123
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
124
|
+
* across all networks at once.
|
|
125
|
+
*
|
|
126
|
+
* @param params.id - The id of the addresses to update.
|
|
127
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
128
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
129
|
+
* @param params.auth - The authentication api key.
|
|
130
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
131
|
+
* @return All addresses.
|
|
132
|
+
*/
|
|
133
|
+
update(params?: {
|
|
134
|
+
id?: string;
|
|
135
|
+
addresses?: AddressesInterface | undefined;
|
|
136
|
+
network?: NetworkType | undefined;
|
|
137
|
+
auth?: string | undefined;
|
|
138
|
+
memo?: string | undefined;
|
|
139
|
+
}): Promise<{
|
|
140
|
+
[k: string]: AddressesInterface;
|
|
141
|
+
}>;
|
|
142
|
+
/**
|
|
143
|
+
* Deletes all addresses of a specified id through the API and clear all
|
|
144
|
+
* addresses in the instance.
|
|
145
|
+
*
|
|
146
|
+
* @param id - The id of the addresses to delete.
|
|
147
|
+
* @param auth - The authentication API key.
|
|
148
|
+
*/
|
|
149
|
+
delete(id?: string, auth?: string): Promise<void>;
|
|
150
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { SuiKit } from '@scallop-io/sui-kit';
|
|
2
|
+
import { ScallopAddress } from './scallopAddress';
|
|
3
|
+
import { ScallopQuery } from './scallopQuery';
|
|
4
|
+
import { ScallopUtils } from './scallopUtils';
|
|
5
|
+
import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
6
|
+
import type { Transaction } from '@mysten/sui/transactions';
|
|
7
|
+
import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
8
|
+
import type { ScallopBuilderParams, ScallopTxBlock, SupportMarketCoins, SupportAssetCoins, SupportSCoin, ScallopBuilderInstanceParams, SelectCoinReturnType } from '../types';
|
|
9
|
+
import { ScallopCache } from './scallopCache';
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const scallopBuilder = new ScallopBuilder(<parameters>);
|
|
17
|
+
* await scallopBuilder.init();
|
|
18
|
+
* const txBlock = scallopBuilder.<builder functions>();
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class ScallopBuilder {
|
|
22
|
+
readonly params: ScallopBuilderParams;
|
|
23
|
+
readonly isTestnet: boolean;
|
|
24
|
+
suiKit: SuiKit;
|
|
25
|
+
address: ScallopAddress;
|
|
26
|
+
query: ScallopQuery;
|
|
27
|
+
utils: ScallopUtils;
|
|
28
|
+
walletAddress: string;
|
|
29
|
+
cache: ScallopCache;
|
|
30
|
+
constructor(params: ScallopBuilderParams, instance?: ScallopBuilderInstanceParams);
|
|
31
|
+
/**
|
|
32
|
+
* Request the scallop API to initialize data.
|
|
33
|
+
*
|
|
34
|
+
* @param force - Whether to force initialization.
|
|
35
|
+
* @param address - ScallopAddress instance.
|
|
36
|
+
*/
|
|
37
|
+
init(force?: boolean, address?: ScallopAddress): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a scallop txBlock instance that enhances transaction block.
|
|
40
|
+
*
|
|
41
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
42
|
+
* @return Scallop txBlock.
|
|
43
|
+
*/
|
|
44
|
+
createTxBlock(txBlock?: ScallopTxBlock | SuiKitTxBlock | Transaction): ScallopTxBlock;
|
|
45
|
+
/**
|
|
46
|
+
* Specifying the sender's amount of coins to get coins args from transaction result.
|
|
47
|
+
*
|
|
48
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
49
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
50
|
+
* @param amount - Amount of coins to be selected.
|
|
51
|
+
* @param sender - Sender address.
|
|
52
|
+
* @return Take coin and left coin.
|
|
53
|
+
*/
|
|
54
|
+
selectCoin<T extends SupportAssetCoins>(txBlock: ScallopTxBlock | SuiKitTxBlock, assetCoinName: T, amount: number, sender?: string): Promise<SelectCoinReturnType<T>>;
|
|
55
|
+
/**
|
|
56
|
+
* Specifying the sender's amount of market coins to get coins args from transaction result.
|
|
57
|
+
*
|
|
58
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
59
|
+
* @param marketCoinName - Specific support market coin name.
|
|
60
|
+
* @param amount - Amount of coins to be selected.
|
|
61
|
+
* @param sender - Sender address.
|
|
62
|
+
* @return Take coin and left coin.
|
|
63
|
+
*/
|
|
64
|
+
selectMarketCoin(txBlock: ScallopTxBlock | SuiKitTxBlock, marketCoinName: SupportMarketCoins, amount: number, sender?: string): Promise<{
|
|
65
|
+
takeCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
|
|
66
|
+
leftCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
|
|
67
|
+
totalAmount: number;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Specifying the sender's amount of sCoins to get coins args from transaction result.
|
|
71
|
+
*
|
|
72
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
73
|
+
* @param marketCoinName - Specific support sCoin name.
|
|
74
|
+
* @param amount - Amount of coins to be selected.
|
|
75
|
+
* @param sender - Sender address.
|
|
76
|
+
* @return Take coin and left coin.
|
|
77
|
+
*/
|
|
78
|
+
selectSCoin(txBlock: ScallopTxBlock | SuiKitTxBlock, sCoinName: SupportSCoin, amount: number, sender?: string): Promise<{
|
|
79
|
+
takeCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
|
|
80
|
+
leftCoin: import("@scallop-io/sui-kit").TransactionObjectArgument;
|
|
81
|
+
totalAmount: number;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Execute Scallop txBlock using the `signAndSendTxn` methods in suikit.
|
|
85
|
+
*
|
|
86
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
87
|
+
*/
|
|
88
|
+
signAndSendTxBlock(txBlock: ScallopTxBlock | SuiKitTxBlock | Transaction): Promise<SuiTransactionBlockResponse>;
|
|
89
|
+
}
|