stable-layer-sdk 3.0.0 → 3.1.0
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/README.md +27 -13
- package/dist/cjs/index.cjs +404 -99
- package/dist/cjs/index.cjs.map +4 -4
- package/dist/esm/index.mjs +389 -99
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/index.d.ts +16 -2
- package/dist/types/interface.d.ts +29 -1
- package/dist/types/libs/constants.d.ts +31 -12
- package/dist/types/libs/constants.mainnet.d.ts +20 -0
- package/dist/types/libs/constants.testnet.d.ts +22 -0
- package/package.json +5 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import { BurnTransactionParams, ClaimTransactionParams, CoinResult, MintTransactionParams, StableLayerConfig } from "./interface.js";
|
|
1
|
+
import { BurnTransactionParams, ClaimRewardUsdbAmountParams, ClaimTransactionParams, CoinResult, MintTransactionParams, SetMaxSupplyTransactionParams, StableLayerConfig } from "./interface.js";
|
|
2
2
|
export declare class StableLayerClient {
|
|
3
3
|
private bucketClient;
|
|
4
4
|
private suiClient;
|
|
5
5
|
private sender;
|
|
6
|
-
|
|
6
|
+
private network;
|
|
7
|
+
private mockFarmRegistryId?;
|
|
8
|
+
private mockFarmPackageId?;
|
|
9
|
+
private mockUsdbCoinType?;
|
|
10
|
+
static getConstants(network: import("./interface.js").Network): import("./libs/constants.js").Constants;
|
|
11
|
+
getConstants(): import("./libs/constants.js").Constants;
|
|
12
|
+
static initialize(config: StableLayerConfig): Promise<StableLayerClient>;
|
|
13
|
+
private constructor();
|
|
14
|
+
private getMockFarmPackageId;
|
|
15
|
+
private getMockFarmEntityType;
|
|
7
16
|
buildMintTx({ tx, stableCoinType, usdcCoin, sender, autoTransfer, }: MintTransactionParams): Promise<CoinResult | undefined>;
|
|
8
17
|
buildBurnTx({ tx, stableCoinType, amount, all, sender, autoTransfer, }: BurnTransactionParams): Promise<CoinResult | undefined>;
|
|
9
18
|
buildClaimTx({ tx, stableCoinType, sender, autoTransfer, }: ClaimTransactionParams): Promise<CoinResult | undefined>;
|
|
19
|
+
getClaimRewardUsdbAmount({ stableCoinType, sender, }: ClaimRewardUsdbAmountParams): Promise<bigint>;
|
|
20
|
+
buildSetMaxSupplyTx({ tx, registry, factoryCapId, maxSupply, stableCoinType, usdCoinType, sender, }: SetMaxSupplyTransactionParams): void;
|
|
10
21
|
getTotalSupply(): Promise<string | undefined>;
|
|
11
22
|
getTotalSupplyByCoinType(stableCoinType: string): Promise<string | undefined>;
|
|
12
23
|
private getBucketSavingPool;
|
|
@@ -14,3 +25,6 @@ export declare class StableLayerClient {
|
|
|
14
25
|
private checkResponse;
|
|
15
26
|
private releaseRewards;
|
|
16
27
|
}
|
|
28
|
+
export * from "./libs/constants.js";
|
|
29
|
+
export { STABLE_REGISTRY_MAINNET_ALT, STABLE_LAYER_PACKAGE_MAINNET_ALT, } from "./libs/constants.mainnet.js";
|
|
30
|
+
export type { ClaimRewardUsdbAmountParams, SetMaxSupplyTransactionParams } from "./interface.js";
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
import type { ConfigType } from "@bucket-protocol/sdk";
|
|
2
|
+
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
1
3
|
import { Transaction, TransactionArgument, TransactionResult } from "@mysten/sui/transactions";
|
|
4
|
+
export type Network = "mainnet" | "testnet";
|
|
2
5
|
export interface StableLayerConfig {
|
|
3
|
-
network:
|
|
6
|
+
network: Network;
|
|
4
7
|
sender: string;
|
|
8
|
+
/** Custom RPC URL. Falls back to SUI_GRPC_URL env or default fullnode URL. */
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
/** Pre-instantiated SuiGrpcClient. When provided, baseUrl is ignored. */
|
|
11
|
+
suiClient?: SuiGrpcClient;
|
|
12
|
+
/** Override entry config object ID for BucketClient (e.g. for testing). */
|
|
13
|
+
configObjectId?: string;
|
|
14
|
+
/** Config overrides passed to BucketClient.initialize (e.g. PRICE_SERVICE_ENDPOINT). */
|
|
15
|
+
configOverrides?: Partial<ConfigType>;
|
|
16
|
+
/** Testnet: optional mock_farm registry, package ID, and mock USDB type for claim preview. */
|
|
17
|
+
mockFarmRegistryId?: string;
|
|
18
|
+
mockFarmPackageId?: string;
|
|
19
|
+
mockUsdbCoinType?: string;
|
|
5
20
|
}
|
|
6
21
|
export interface MintTransactionParams {
|
|
7
22
|
tx: Transaction;
|
|
@@ -25,4 +40,17 @@ export interface ClaimTransactionParams {
|
|
|
25
40
|
sender?: string;
|
|
26
41
|
autoTransfer?: boolean;
|
|
27
42
|
}
|
|
43
|
+
export interface ClaimRewardUsdbAmountParams {
|
|
44
|
+
stableCoinType: string;
|
|
45
|
+
sender: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SetMaxSupplyTransactionParams {
|
|
48
|
+
tx: Transaction;
|
|
49
|
+
registry: string;
|
|
50
|
+
factoryCapId: string;
|
|
51
|
+
maxSupply: bigint;
|
|
52
|
+
stableCoinType: string;
|
|
53
|
+
usdCoinType: string;
|
|
54
|
+
sender?: string;
|
|
55
|
+
}
|
|
28
56
|
export type CoinResult = TransactionResult | TransactionResult[number];
|
|
@@ -1,12 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import type { Network } from "../interface.js";
|
|
2
|
+
export type Constants = {
|
|
3
|
+
STABLE_VAULT: string;
|
|
4
|
+
USDC_TYPE: string;
|
|
5
|
+
STABLE_LP_TYPE: string;
|
|
6
|
+
YUSDB_TYPE: string;
|
|
7
|
+
STABLE_LAYER_PACKAGE_ID: string;
|
|
8
|
+
STABLE_VAULT_FARM_PACKAGE_ID: string;
|
|
9
|
+
SAVING_TYPE: string;
|
|
10
|
+
YIELD_VAULT: string;
|
|
11
|
+
STABLE_REGISTRY: string;
|
|
12
|
+
STABLE_VAULT_FARM: string;
|
|
13
|
+
YIELD_USDB_PACKAGE_ID: string;
|
|
14
|
+
STABLE_VAULT_FARM_ENTITY_TYPE: string;
|
|
15
|
+
MOCK_FARM_PACKAGE_ID: string;
|
|
16
|
+
MOCK_FARM_REGISTRY: string;
|
|
17
|
+
MOCK_USDB_TYPE: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function getConstants(network: Network): Constants;
|
|
20
|
+
export declare const STABLE_VAULT: "0x65f38160110cd6859d05f338ff54b4f462883bb6f87c667a65c0fb0e537410a7";
|
|
21
|
+
export declare const USDC_TYPE: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
22
|
+
export declare const STABLE_LP_TYPE: "0xb75744fadcbfc174627567ca29645d0af8f6e6fd01b6f57c75a08cd3fb97c567::lake_usdc::LakeUSDC";
|
|
23
|
+
export declare const YUSDB_TYPE: "0xac718b4b672d7f461fe7e86847166ff9c23cadba217397f0848a95bdea1f1051::yesusdb::YesUSDB";
|
|
24
|
+
export declare const STABLE_LAYER_PACKAGE_ID: "0xa4a78d8d3d1df62fb81d10068142e79b0d30ad4e3f578060487e36ed9ea764da";
|
|
25
|
+
export declare const STABLE_VAULT_FARM_PACKAGE_ID: "0x00d31ddaa73a56abcc3e2d885ac1e1d90f9ae0e38bbef2ba2923550c8250de4d";
|
|
26
|
+
export declare const SAVING_TYPE: "0x38f61c75fa8407140294c84167dd57684580b55c3066883b48dedc344b1cde1e::susdb::SUSDB";
|
|
27
|
+
export declare const YIELD_VAULT: "0x0a7f6325253157cd437812fea0ceee9a6b96f2ec5eac410da6df39558ff3a4d1";
|
|
28
|
+
export declare const STABLE_REGISTRY: "0x213f4d584c0770f455bb98c94a4ee5ea9ddbc3d4ebb98a0ad6d093eb6da41642";
|
|
29
|
+
export declare const STABLE_VAULT_FARM: "0xe958b7d102b33bf3c09addb0e2cdff102ff2c93afe407ec5c2a541e8959a650c";
|
|
30
|
+
export declare const YIELD_USDB_PACKAGE_ID: "0x3dcbf82f7e3b80ed65cee596612602a6c7e78c71fd40f6455b40ad033ed04786";
|
|
31
|
+
export declare const STABLE_VAULT_FARM_ENTITY_TYPE: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Alternate mainnet deployment — registry 0x213f4d58... belongs to this package */
|
|
2
|
+
export declare const STABLE_REGISTRY_MAINNET_ALT = "0x213f4d584c0770f455bb98c94a4ee5ea9ddbc3d4ebb98a0ad6d093eb6da41642";
|
|
3
|
+
export declare const STABLE_LAYER_PACKAGE_MAINNET_ALT = "0x41e25d09e20cf3bc43fe321e51ef178fac419ae47b783a7161982158fc9f17d6";
|
|
4
|
+
/** Mainnet object IDs and type strings */
|
|
5
|
+
export declare const MAINNET: {
|
|
6
|
+
readonly STABLE_VAULT: "0x65f38160110cd6859d05f338ff54b4f462883bb6f87c667a65c0fb0e537410a7";
|
|
7
|
+
readonly USDC_TYPE: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
8
|
+
readonly STABLE_LP_TYPE: "0xb75744fadcbfc174627567ca29645d0af8f6e6fd01b6f57c75a08cd3fb97c567::lake_usdc::LakeUSDC";
|
|
9
|
+
readonly YUSDB_TYPE: "0xac718b4b672d7f461fe7e86847166ff9c23cadba217397f0848a95bdea1f1051::yesusdb::YesUSDB";
|
|
10
|
+
readonly STABLE_LAYER_PACKAGE_ID: "0xa4a78d8d3d1df62fb81d10068142e79b0d30ad4e3f578060487e36ed9ea764da";
|
|
11
|
+
readonly STABLE_REGISTRY_MAINNET_ALT: "0x213f4d584c0770f455bb98c94a4ee5ea9ddbc3d4ebb98a0ad6d093eb6da41642";
|
|
12
|
+
readonly STABLE_LAYER_PACKAGE_MAINNET_ALT: "0x41e25d09e20cf3bc43fe321e51ef178fac419ae47b783a7161982158fc9f17d6";
|
|
13
|
+
readonly STABLE_VAULT_FARM_PACKAGE_ID: "0x00d31ddaa73a56abcc3e2d885ac1e1d90f9ae0e38bbef2ba2923550c8250de4d";
|
|
14
|
+
readonly SAVING_TYPE: "0x38f61c75fa8407140294c84167dd57684580b55c3066883b48dedc344b1cde1e::susdb::SUSDB";
|
|
15
|
+
readonly YIELD_VAULT: "0x0a7f6325253157cd437812fea0ceee9a6b96f2ec5eac410da6df39558ff3a4d1";
|
|
16
|
+
readonly STABLE_REGISTRY: "0x213f4d584c0770f455bb98c94a4ee5ea9ddbc3d4ebb98a0ad6d093eb6da41642";
|
|
17
|
+
readonly STABLE_VAULT_FARM: "0xe958b7d102b33bf3c09addb0e2cdff102ff2c93afe407ec5c2a541e8959a650c";
|
|
18
|
+
readonly YIELD_USDB_PACKAGE_ID: "0x3dcbf82f7e3b80ed65cee596612602a6c7e78c71fd40f6455b40ad033ed04786";
|
|
19
|
+
};
|
|
20
|
+
export declare const STABLE_VAULT_FARM_ENTITY_TYPE_MAINNET: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const MOCK_FARM_PACKAGE_ID_TESTNET: "0x3a55ec8fabe5f3e982908ed3a7c3065f26e83ab226eb8d3450177dbaac25878b";
|
|
2
|
+
export declare const MOCK_FARM_ORIGINAL_PACKAGE_ID_TESTNET: "0x673d4118c17de717b0b90c326f8f52f87b5fff8678f513edd2ae575a55175954";
|
|
3
|
+
export declare const MOCK_FARM_REGISTRY_TESTNET: "0xc3e8d2e33e36f6a4b5c199fe2dde3ba6dc29e7af8dd045c86e62d7c21f374d02";
|
|
4
|
+
export declare const MOCK_USDB_TYPE_TESTNET: "0x673d4118c17de717b0b90c326f8f52f87b5fff8678f513edd2ae575a55175954::usdb::USDB";
|
|
5
|
+
export declare const TESTNET: {
|
|
6
|
+
readonly STABLE_LAYER_PACKAGE_ID: "0x9c248c80c3a757167780f17e0c00a4d293280be7276f1b81a153f6e47d2567c9";
|
|
7
|
+
readonly STABLE_REGISTRY: "0xfa0fd96e0fbc07dc6bdc23cc1ac5b4c0056f4b469b9db0a70b6ea01c14a4c7b5";
|
|
8
|
+
readonly USDC_TYPE: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC";
|
|
9
|
+
readonly STABLE_VAULT_FARM_ENTITY_TYPE: "0x673d4118c17de717b0b90c326f8f52f87b5fff8678f513edd2ae575a55175954::farm::MockFarmEntity";
|
|
10
|
+
readonly MOCK_FARM_PACKAGE_ID: "0x3a55ec8fabe5f3e982908ed3a7c3065f26e83ab226eb8d3450177dbaac25878b";
|
|
11
|
+
readonly MOCK_FARM_REGISTRY: "0xc3e8d2e33e36f6a4b5c199fe2dde3ba6dc29e7af8dd045c86e62d7c21f374d02";
|
|
12
|
+
readonly MOCK_USDB_TYPE: "0x673d4118c17de717b0b90c326f8f52f87b5fff8678f513edd2ae575a55175954::usdb::USDB";
|
|
13
|
+
readonly STABLE_VAULT: "";
|
|
14
|
+
readonly STABLE_LP_TYPE: "";
|
|
15
|
+
readonly YUSDB_TYPE: "";
|
|
16
|
+
readonly STABLE_VAULT_FARM_PACKAGE_ID: "";
|
|
17
|
+
readonly SAVING_TYPE: "";
|
|
18
|
+
readonly YIELD_VAULT: "";
|
|
19
|
+
readonly STABLE_VAULT_FARM: "";
|
|
20
|
+
readonly YIELD_USDB_PACKAGE_ID: "";
|
|
21
|
+
};
|
|
22
|
+
export declare const STABLE_VAULT_FARM_ENTITY_TYPE_TESTNET: "0x673d4118c17de717b0b90c326f8f52f87b5fff8678f513edd2ae575a55175954::farm::MockFarmEntity";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stable-layer-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "A TypeScript SDK for Stable Layer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
"build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
|
|
39
39
|
"dev": "tsc --watch",
|
|
40
40
|
"test": "vitest",
|
|
41
|
+
"test:e2e:testnet": "vitest run --config vitest.e2e-testnet.config.ts",
|
|
42
|
+
"query-output": "QUERY_OUTPUT=1 vitest run",
|
|
43
|
+
"sl:mint": "node ./scripts/sl-mint.mjs",
|
|
41
44
|
"format": "prettier --write .",
|
|
42
45
|
"format:check": "prettier --check ."
|
|
43
46
|
},
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
"vitest": "^4.0.7"
|
|
63
66
|
},
|
|
64
67
|
"dependencies": {
|
|
65
|
-
"@bucket-protocol/sdk": "2.
|
|
68
|
+
"@bucket-protocol/sdk": "^2.1.0"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
68
71
|
"@mysten/bcs": ">=2.0.0",
|