dipcoin-cli 0.8.2 → 1.0.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 +52 -240
- package/dist/cli.cjs +16558 -16214
- package/dist/cli.cjs.map +1 -1
- package/dist/config/deployed/mainnet/main_contract.json +184 -1
- package/package.json +3 -24
- package/dist/cli/commands/account.d.ts +0 -3
- package/dist/cli/commands/account.d.ts.map +0 -1
- package/dist/cli/commands/balance.d.ts +0 -3
- package/dist/cli/commands/balance.d.ts.map +0 -1
- package/dist/cli/commands/history.d.ts +0 -3
- package/dist/cli/commands/history.d.ts.map +0 -1
- package/dist/cli/commands/market.d.ts +0 -3
- package/dist/cli/commands/market.d.ts.map +0 -1
- package/dist/cli/commands/orders.d.ts +0 -3
- package/dist/cli/commands/orders.d.ts.map +0 -1
- package/dist/cli/commands/position.d.ts +0 -3
- package/dist/cli/commands/position.d.ts.map +0 -1
- package/dist/cli/commands/sub-account.d.ts +0 -3
- package/dist/cli/commands/sub-account.d.ts.map +0 -1
- package/dist/cli/commands/trade.d.ts +0 -3
- package/dist/cli/commands/trade.d.ts.map +0 -1
- package/dist/cli/commands/vault.d.ts +0 -3
- package/dist/cli/commands/vault.d.ts.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/utils/output.d.ts +0 -15
- package/dist/cli/utils/output.d.ts.map +0 -1
- package/dist/cli/utils/sdk-factory.d.ts +0 -38
- package/dist/cli/utils/sdk-factory.d.ts.map +0 -1
- package/dist/cli/utils/vault-index.d.ts +0 -6
- package/dist/cli/utils/vault-index.d.ts.map +0 -1
- package/dist/index.cjs.js +0 -4
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -4
- package/dist/index.esm.js.map +0 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/dist/src/__tests__/sdk.test.d.ts +0 -2
- package/dist/src/__tests__/sdk.test.d.ts.map +0 -1
- package/dist/src/config/index.d.ts +0 -15
- package/dist/src/config/index.d.ts.map +0 -1
- package/dist/src/constants/index.d.ts +0 -56
- package/dist/src/constants/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -20
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/onchain/exchange.d.ts +0 -41
- package/dist/src/onchain/exchange.d.ts.map +0 -1
- package/dist/src/onchain/index.d.ts +0 -5
- package/dist/src/onchain/index.d.ts.map +0 -1
- package/dist/src/onchain/order-signer.d.ts +0 -17
- package/dist/src/onchain/order-signer.d.ts.map +0 -1
- package/dist/src/onchain/transaction-builder.d.ts +0 -46
- package/dist/src/onchain/transaction-builder.d.ts.map +0 -1
- package/dist/src/sdk/index.d.ts +0 -2
- package/dist/src/sdk/index.d.ts.map +0 -1
- package/dist/src/sdk/sdk.d.ts +0 -413
- package/dist/src/sdk/sdk.d.ts.map +0 -1
- package/dist/src/services/httpClient.d.ts +0 -25
- package/dist/src/services/httpClient.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -608
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -62
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/jwt-cache.d.ts +0 -14
- package/dist/src/utils/jwt-cache.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/sdk.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DipCoinPerpSDKOptions } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Default API base URLs
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_API_URLS: {
|
|
6
|
-
mainnet: string;
|
|
7
|
-
testnet: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Initialize SDK options with defaults
|
|
11
|
-
*/
|
|
12
|
-
export declare function initSDKOptions(options: Partial<DipCoinPerpSDKOptions> & {
|
|
13
|
-
network: "mainnet" | "testnet";
|
|
14
|
-
}): DipCoinPerpSDKOptions;
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAC3E,qBAAqB,CAOvB"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default values and constants
|
|
3
|
-
*/
|
|
4
|
-
export declare const DEFAULT_SLIPPAGE = 0.05;
|
|
5
|
-
/**
|
|
6
|
-
* API endpoints
|
|
7
|
-
*/
|
|
8
|
-
export declare const API_ENDPOINTS: {
|
|
9
|
-
readonly AUTHORIZE: "/api/authorize";
|
|
10
|
-
readonly PLACE_ORDER: "/api/perp-trade-api/trade/placeorder";
|
|
11
|
-
readonly CANCEL_ORDER: "/api/perp-trade-api/trade/cancelorder";
|
|
12
|
-
readonly PLAN_CLOSE_ORDER: "/api/perp-trade-api/plan/batch/plancloseorder";
|
|
13
|
-
readonly CANCEL_PLAN_ORDER: "/api/perp-trade-api/plan/cancelplanorder";
|
|
14
|
-
readonly ADJUST_LEVERAGE: "/api/perp-trade-api/user-config/adjust-leverage";
|
|
15
|
-
readonly GET_USER_CONFIG: "/api/perp-trade-api/user-config/config";
|
|
16
|
-
readonly GET_ACCOUNT_INFO: "/api/perp-trade-api/curr-info/account";
|
|
17
|
-
readonly GET_POSITIONS: "/api/perp-trade-api/curr-info/positions";
|
|
18
|
-
readonly GET_OPEN_ORDERS: "/api/perp-trade-api/curr-info/orders";
|
|
19
|
-
readonly GET_TRADING_PAIRS: "/api/perp-market-api/list";
|
|
20
|
-
readonly GET_ORDER_BOOK: "/api/perp-market-api/orderBook";
|
|
21
|
-
readonly GET_TICKER: "/api/perp-market-api/ticker";
|
|
22
|
-
readonly GET_POSITION_TPSL: "/api/perp-trade-api/plan/position/tpsl";
|
|
23
|
-
readonly HISTORY_ORDERS: "/api/perp-trade-api/history/orders";
|
|
24
|
-
readonly FUNDING_SETTLEMENTS: "/api/perp-trade-api/history/funding-settlements";
|
|
25
|
-
readonly BALANCE_CHANGES: "/api/perp-trade-api/history/balance-changes";
|
|
26
|
-
readonly ORACLE: "/api/perp-market-api/oracle";
|
|
27
|
-
readonly VAULTS_BY_CREATOR: "/api/perp-vault-api/public/vaults/by-creator";
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Onboarding message for authentication
|
|
31
|
-
*/
|
|
32
|
-
export declare const ONBOARDING_MESSAGE = "{\"onboardingUrl\":\"dipcoin.io\"}";
|
|
33
|
-
/**
|
|
34
|
-
* Decimal precision for formatting
|
|
35
|
-
*/
|
|
36
|
-
export declare const DECIMALS: {
|
|
37
|
-
readonly USDC: 6;
|
|
38
|
-
readonly SUI: 9;
|
|
39
|
-
readonly DEFAULT: 18;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Pyth + Wormhole configuration per network
|
|
43
|
-
*/
|
|
44
|
-
export declare const PYTH_CONFIG: {
|
|
45
|
-
readonly mainnet: {
|
|
46
|
-
readonly wormholeStateId: "0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c";
|
|
47
|
-
readonly pythStateId: "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
|
|
48
|
-
readonly priceServiceUrl: "https://hermes.pyth.network/";
|
|
49
|
-
};
|
|
50
|
-
readonly testnet: {
|
|
51
|
-
readonly wormholeStateId: "0x31358d198147da50db32eda2562951d53973a0c0ad5ed738e9b17d88b213d790";
|
|
52
|
-
readonly pythStateId: "0x243759059f4c3111179da5878c12f68d612c21a8d54d85edc86164bb18be1c7c";
|
|
53
|
-
readonly priceServiceUrl: "https://hermes-beta.pyth.network";
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;CAoBhB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,uCAAmC,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;CAWd,CAAC"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from "./config";
|
|
2
|
-
export * from "./sdk";
|
|
3
|
-
export { HttpClient } from "./services/httpClient";
|
|
4
|
-
export * from "./types";
|
|
5
|
-
export * from "./utils";
|
|
6
|
-
export * from "./constants";
|
|
7
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
8
|
-
import { DipCoinPerpSDK } from "./sdk";
|
|
9
|
-
import { DipCoinPerpSDKOptions } from "./types";
|
|
10
|
-
/**
|
|
11
|
-
* Initialize DipCoin Perpetual Trading SDK
|
|
12
|
-
* @param privateKey Private key string or Keypair instance
|
|
13
|
-
* @param options SDK configuration options
|
|
14
|
-
* @returns Initialized SDK instance
|
|
15
|
-
*/
|
|
16
|
-
export declare function initDipCoinPerpSDK(privateKey: string | Keypair, options: Partial<DipCoinPerpSDKOptions> & {
|
|
17
|
-
network: "mainnet" | "testnet";
|
|
18
|
-
}): DipCoinPerpSDK;
|
|
19
|
-
export default DipCoinPerpSDK;
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GAAG,OAAO,EAC5B,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG;IAAE,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,GAC3E,cAAc,CAGhB;AAGD,eAAe,cAAc,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SuiClient, SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
2
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
3
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
4
|
-
export declare function executeTxBlock(suiClient: SuiClient, tx: Transaction, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
5
|
-
export declare function getDeploymentPerpetualID(deployment: any, market?: string): string;
|
|
6
|
-
export declare function getOraclePrice(suiClient: SuiClient, deployment: any, market: string): Promise<number>;
|
|
7
|
-
export declare function depositToBank(suiClient: SuiClient, deployment: any, args: {
|
|
8
|
-
amount: string;
|
|
9
|
-
accountAddress?: string;
|
|
10
|
-
bankID?: string;
|
|
11
|
-
gasBudget?: number;
|
|
12
|
-
}, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
13
|
-
export declare function withdrawFromBank(suiClient: SuiClient, deployment: any, args: {
|
|
14
|
-
amount: string;
|
|
15
|
-
accountAddress?: string;
|
|
16
|
-
bankID?: string;
|
|
17
|
-
gasBudget?: number;
|
|
18
|
-
}, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
19
|
-
export declare function addMargin(suiClient: SuiClient, deployment: any, args: {
|
|
20
|
-
amount: number;
|
|
21
|
-
account?: string;
|
|
22
|
-
perpID?: string;
|
|
23
|
-
subAccountsMapID?: string;
|
|
24
|
-
market?: string;
|
|
25
|
-
gasBudget?: number;
|
|
26
|
-
}, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
27
|
-
export declare function removeMargin(suiClient: SuiClient, deployment: any, args: {
|
|
28
|
-
amount: number;
|
|
29
|
-
account?: string;
|
|
30
|
-
perpID?: string;
|
|
31
|
-
subAccountsMapID?: string;
|
|
32
|
-
market?: string;
|
|
33
|
-
gasBudget?: number;
|
|
34
|
-
}, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
35
|
-
export declare function setSubAccount(suiClient: SuiClient, deployment: any, args: {
|
|
36
|
-
account: string;
|
|
37
|
-
status: boolean;
|
|
38
|
-
subAccountsMapID?: string;
|
|
39
|
-
gasBudget?: number;
|
|
40
|
-
}, signer: Keypair): Promise<SuiTransactionBlockResponse>;
|
|
41
|
-
//# sourceMappingURL=exchange.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../../src/onchain/exchange.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAWvD,wBAAsB,cAAc,CAClC,SAAS,EAAE,SAAS,EACpB,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAWtC;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACtF,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAGtC;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACtF,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAGtC;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAGtC;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAGtC;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,GAAG,EACf,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACzF,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,2BAA2B,CAAC,CAGtC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { getOrderMessageForUIWallet } from "./order-signer";
|
|
2
|
-
export type { Order } from "./order-signer";
|
|
3
|
-
export { buildAddMarginTx, buildRemoveMarginTx, buildDepositTx, buildWithdrawTx, buildSetSubAccountTx, buildSetOraclePriceTx, buildBatchSetOraclePriceTx, getPerpetualId, getPriceOracleObjectId, } from "./transaction-builder";
|
|
4
|
-
export { executeTxBlock, getDeploymentPerpetualID, getOraclePrice, depositToBank, withdrawFromBank, addMargin, removeMargin, setSubAccount, } from "./exchange";
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/onchain/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,cAAc,EACd,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,YAAY,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
export interface Order {
|
|
3
|
-
market: string;
|
|
4
|
-
creator: string;
|
|
5
|
-
isLong: boolean;
|
|
6
|
-
reduceOnly: boolean;
|
|
7
|
-
postOnly: boolean;
|
|
8
|
-
orderbookOnly: boolean;
|
|
9
|
-
ioc: boolean;
|
|
10
|
-
quantity: BigNumber;
|
|
11
|
-
price: BigNumber;
|
|
12
|
-
leverage: BigNumber;
|
|
13
|
-
expiration: BigNumber;
|
|
14
|
-
salt: BigNumber;
|
|
15
|
-
}
|
|
16
|
-
export declare function getOrderMessageForUIWallet(order: Order): string;
|
|
17
|
-
//# sourceMappingURL=order-signer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order-signer.d.ts","sourceRoot":"","sources":["../../../src/onchain/order-signer.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,SAAS,CAAC;CACjB;AAsBD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAkB/D"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
-
declare function getPerpetualId(deployment: any, market?: string): string;
|
|
3
|
-
declare function getPriceOracleObjectId(deployment: any, market?: string): string;
|
|
4
|
-
export declare function buildAddMarginTx(deployment: any, args: {
|
|
5
|
-
amount: number;
|
|
6
|
-
account?: string;
|
|
7
|
-
perpID?: string;
|
|
8
|
-
subAccountsMapID?: string;
|
|
9
|
-
market?: string;
|
|
10
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
11
|
-
export declare function buildRemoveMarginTx(deployment: any, args: {
|
|
12
|
-
amount: number;
|
|
13
|
-
account?: string;
|
|
14
|
-
perpID?: string;
|
|
15
|
-
subAccountsMapID?: string;
|
|
16
|
-
market?: string;
|
|
17
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
18
|
-
export declare function buildDepositTx(deployment: any, args: {
|
|
19
|
-
amount: string;
|
|
20
|
-
accountAddress?: string;
|
|
21
|
-
bankID?: string;
|
|
22
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
23
|
-
export declare function buildWithdrawTx(deployment: any, args: {
|
|
24
|
-
amount: string;
|
|
25
|
-
accountAddress?: string;
|
|
26
|
-
bankID?: string;
|
|
27
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
28
|
-
export declare function buildSetSubAccountTx(deployment: any, args: {
|
|
29
|
-
account: string;
|
|
30
|
-
status: boolean;
|
|
31
|
-
subAccountsMapID?: string;
|
|
32
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
33
|
-
export declare function buildSetOraclePriceTx(deployment: any, args: {
|
|
34
|
-
price: number;
|
|
35
|
-
confidence?: string;
|
|
36
|
-
market?: string;
|
|
37
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
38
|
-
export declare function buildBatchSetOraclePriceTx(deployment: any, args: {
|
|
39
|
-
prices: {
|
|
40
|
-
price: number;
|
|
41
|
-
confidence?: string;
|
|
42
|
-
market?: string;
|
|
43
|
-
}[];
|
|
44
|
-
}, tx?: Transaction, gasBudget?: number, sender?: string): Transaction;
|
|
45
|
-
export { getPerpetualId, getPriceOracleObjectId };
|
|
46
|
-
//# sourceMappingURL=transaction-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-builder.d.ts","sourceRoot":"","sources":["../../../src/onchain/transaction-builder.ts"],"names":[],"mappings":"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"}
|
package/dist/src/sdk/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":"AAGA,cAAc,OAAO,CAAC"}
|
package/dist/src/sdk/sdk.d.ts
DELETED
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import { SuiTransactionBlockResponse } from "@mysten/sui/client";
|
|
2
|
-
import { Keypair } from "@mysten/sui/cryptography";
|
|
3
|
-
import { AccountInfo, AccountInfoParams, AdjustLeverageParams, BalanceChange, BalanceChangesParams, CancelOrderParams, CancelTpSlOrdersParams, DipCoinPerpSDKOptions, FundingSettlement, FundingSettlementsParams, HistoryOrder, HistoryOrdersParams, MarginAdjustmentParams, OpenOrder, OpenOrdersParams, OrderBook, OrderResponse, PageResponse, PlaceOrderParams, PlaceTpSlOrdersParams, PlaceTpSlOrdersResult, Position, PositionTpSlOrder, PositionsParams, SDKResponse, Ticker, TpSlMode, TradingPair, UserConfig } from "../types";
|
|
4
|
-
/**
|
|
5
|
-
* DipCoin Perpetual Trading SDK
|
|
6
|
-
*/
|
|
7
|
-
export declare class DipCoinPerpSDK {
|
|
8
|
-
private httpClient;
|
|
9
|
-
private keypair;
|
|
10
|
-
private subKeypair?;
|
|
11
|
-
private walletAddress;
|
|
12
|
-
private subAddress?;
|
|
13
|
-
private options;
|
|
14
|
-
private jwtToken?;
|
|
15
|
-
private subJwtToken?;
|
|
16
|
-
private isAuthenticating;
|
|
17
|
-
private isSubAuthenticating;
|
|
18
|
-
private deploymentConfig;
|
|
19
|
-
private suiClient;
|
|
20
|
-
private priceServiceConnection?;
|
|
21
|
-
private pythClient?;
|
|
22
|
-
private tradingPairsCache?;
|
|
23
|
-
private tradingPairsCacheTimestamp?;
|
|
24
|
-
/**
|
|
25
|
-
* Initialize SDK
|
|
26
|
-
* @param privateKey Private key string or keypair
|
|
27
|
-
* @param options SDK configuration options
|
|
28
|
-
*/
|
|
29
|
-
constructor(privateKey: string | Keypair, options: DipCoinPerpSDKOptions);
|
|
30
|
-
/**
|
|
31
|
-
* Get wallet address
|
|
32
|
-
*/
|
|
33
|
-
get address(): string;
|
|
34
|
-
/**
|
|
35
|
-
* Get sub-account wallet address (if configured)
|
|
36
|
-
*/
|
|
37
|
-
get subAccountAddress(): string | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Get SDK options
|
|
40
|
-
*/
|
|
41
|
-
get optionsField(): DipCoinPerpSDKOptions;
|
|
42
|
-
/**
|
|
43
|
-
* Authenticate and get JWT token (onboarding)
|
|
44
|
-
* This method signs the onboarding message and exchanges it for a JWT token
|
|
45
|
-
* @returns JWT token
|
|
46
|
-
*/
|
|
47
|
-
authenticate(): Promise<SDKResponse<string>>;
|
|
48
|
-
/**
|
|
49
|
-
* Authenticate sub-account and get JWT token
|
|
50
|
-
* Used for trading operations when sub-account is configured
|
|
51
|
-
*/
|
|
52
|
-
authenticateSub(): Promise<SDKResponse<string>>;
|
|
53
|
-
/**
|
|
54
|
-
* Authenticate for trading operations
|
|
55
|
-
* Uses sub-account if configured, otherwise falls back to main account
|
|
56
|
-
*/
|
|
57
|
-
private authenticateForTrading;
|
|
58
|
-
/**
|
|
59
|
-
* Restore main account auth context after trading operations
|
|
60
|
-
*/
|
|
61
|
-
private restoreMainAuth;
|
|
62
|
-
/**
|
|
63
|
-
* Get JWT token, authenticate if needed
|
|
64
|
-
* @param forceRefresh Force refresh the token even if one exists
|
|
65
|
-
* @returns JWT token
|
|
66
|
-
*/
|
|
67
|
-
getJWTToken(forceRefresh?: boolean): Promise<SDKResponse<string>>;
|
|
68
|
-
/**
|
|
69
|
-
* Clear JWT token (logout)
|
|
70
|
-
*/
|
|
71
|
-
clearAuth(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Place an order
|
|
74
|
-
* @param params Order parameters
|
|
75
|
-
* @returns Order response
|
|
76
|
-
*/
|
|
77
|
-
placeOrder(params: PlaceOrderParams): Promise<SDKResponse<OrderResponse>>;
|
|
78
|
-
/**
|
|
79
|
-
* Cancel an order
|
|
80
|
-
* @param params Cancel order parameters
|
|
81
|
-
* @returns Cancel order response
|
|
82
|
-
*/
|
|
83
|
-
cancelOrder(params: CancelOrderParams): Promise<SDKResponse<OrderResponse>>;
|
|
84
|
-
/**
|
|
85
|
-
* Adjust preferred leverage for a symbol (matches ts-frontend behavior)
|
|
86
|
-
* @param params Adjust leverage parameters
|
|
87
|
-
*/
|
|
88
|
-
adjustLeverage(params: AdjustLeverageParams): Promise<SDKResponse<OrderResponse>>;
|
|
89
|
-
/**
|
|
90
|
-
* Fetch current user config (preferred leverage & margin type) for a symbol
|
|
91
|
-
* Mirrors ts-frontend behavior: GET /user-config/config + formatWeiToNormal
|
|
92
|
-
* @param symbol Trading symbol, e.g. "BTC-PERP"
|
|
93
|
-
*/
|
|
94
|
-
getUserConfig(symbol: string): Promise<SDKResponse<UserConfig>>;
|
|
95
|
-
/**
|
|
96
|
-
* Place or edit TP/SL orders for a position
|
|
97
|
-
*/
|
|
98
|
-
placePositionTpSlOrders(params: PlaceTpSlOrdersParams): Promise<SDKResponse<PlaceTpSlOrdersResult>>;
|
|
99
|
-
/**
|
|
100
|
-
* Get TP/SL orders for a position
|
|
101
|
-
*/
|
|
102
|
-
getPositionTpSl(positionId: string | number, tpslType?: TpSlMode): Promise<SDKResponse<PositionTpSlOrder[]>>;
|
|
103
|
-
/**
|
|
104
|
-
* Cancel TP/SL orders (alias of cancelOrder)
|
|
105
|
-
*/
|
|
106
|
-
cancelTpSlOrders(params: CancelTpSlOrdersParams): Promise<SDKResponse<OrderResponse>>;
|
|
107
|
-
/**
|
|
108
|
-
* Get account information
|
|
109
|
-
* @returns Account info response
|
|
110
|
-
*/
|
|
111
|
-
getAccountInfo(params?: AccountInfoParams): Promise<SDKResponse<AccountInfo>>;
|
|
112
|
-
/**
|
|
113
|
-
* Get positions
|
|
114
|
-
* @param symbol Optional symbol filter
|
|
115
|
-
* @returns Positions response
|
|
116
|
-
*/
|
|
117
|
-
getPositions(paramsOrSymbol?: string | PositionsParams): Promise<SDKResponse<Position[]>>;
|
|
118
|
-
/**
|
|
119
|
-
* Get trading pairs list
|
|
120
|
-
* This can be used to find the PerpetualID (perpId) for a given symbol
|
|
121
|
-
* @returns Trading pairs response
|
|
122
|
-
*/
|
|
123
|
-
getTradingPairs(): Promise<SDKResponse<TradingPair[]>>;
|
|
124
|
-
/**
|
|
125
|
-
* Get PerpetualID for a given symbol
|
|
126
|
-
* @param symbol Trading symbol (e.g., "BTC-PERP")
|
|
127
|
-
* @returns PerpetualID or null if not found
|
|
128
|
-
*/
|
|
129
|
-
getPerpetualID(symbol: string): Promise<string | null>;
|
|
130
|
-
/**
|
|
131
|
-
* Get open orders
|
|
132
|
-
* @param symbol Optional symbol filter
|
|
133
|
-
* @returns Open orders response
|
|
134
|
-
*/
|
|
135
|
-
getOpenOrders(paramsOrSymbol?: string | OpenOrdersParams): Promise<SDKResponse<OpenOrder[]>>;
|
|
136
|
-
/**
|
|
137
|
-
* Get order book for a trading pair
|
|
138
|
-
* @param symbol Trading symbol (e.g., "BTC-PERP")
|
|
139
|
-
* @returns Order book response with bids and asks
|
|
140
|
-
* @example
|
|
141
|
-
* ```typescript
|
|
142
|
-
* const orderBook = await sdk.getOrderBook("BTC-PERP");
|
|
143
|
-
* if (orderBook.status && orderBook.data) {
|
|
144
|
-
* console.log("Bids:", orderBook.data.bids);
|
|
145
|
-
* console.log("Asks:", orderBook.data.asks);
|
|
146
|
-
* }
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
getOrderBook(symbol: string): Promise<SDKResponse<OrderBook>>;
|
|
150
|
-
/**
|
|
151
|
-
* Process order book entries from API format to OrderBookEntry format
|
|
152
|
-
* Match ts-frontend: processOrderBookEntries method
|
|
153
|
-
* @param entries Raw entries from API (array of [price, quantity, orderNum] or objects)
|
|
154
|
-
* @param side "bids" or "asks"
|
|
155
|
-
* @returns Processed OrderBookEntry array
|
|
156
|
-
*/
|
|
157
|
-
private processOrderBookEntries;
|
|
158
|
-
/**
|
|
159
|
-
* Format wei value to normal units (18 decimals)
|
|
160
|
-
* Match ts-frontend: formatWeiToNormal function
|
|
161
|
-
* @param value Value in wei (string or number)
|
|
162
|
-
* @param decimals Number of decimals (default 18)
|
|
163
|
-
* @returns Formatted string in normal units
|
|
164
|
-
*/
|
|
165
|
-
private formatWeiToNormal;
|
|
166
|
-
/**
|
|
167
|
-
* Get ticker information for a trading pair
|
|
168
|
-
* @param symbol Trading symbol (e.g., "BTC-PERP")
|
|
169
|
-
* @returns Ticker information response
|
|
170
|
-
* @example
|
|
171
|
-
* ```typescript
|
|
172
|
-
* const ticker = await sdk.getTicker("BTC-PERP");
|
|
173
|
-
* if (ticker.status && ticker.data) {
|
|
174
|
-
* console.log("Last Price:", ticker.data.lastPrice);
|
|
175
|
-
* console.log("24h Volume:", ticker.data.volume24h);
|
|
176
|
-
* console.log("24h Change:", ticker.data.rate24h);
|
|
177
|
-
* }
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
getTicker(symbol: string): Promise<SDKResponse<Ticker>>;
|
|
181
|
-
/**
|
|
182
|
-
* Transform raw TP/SL order data into SDK-friendly format
|
|
183
|
-
*/
|
|
184
|
-
private transformPositionTpSlOrder;
|
|
185
|
-
/**
|
|
186
|
-
* Check whether TP/SL config should be submitted
|
|
187
|
-
*/
|
|
188
|
-
private hasTpSlOrderConfig;
|
|
189
|
-
/**
|
|
190
|
-
* Determine if a numeric input is greater than zero
|
|
191
|
-
*/
|
|
192
|
-
private isPositiveNumber;
|
|
193
|
-
/**
|
|
194
|
-
* Process ticker data from API format to Ticker format
|
|
195
|
-
* Keep all values in wei format - no conversion
|
|
196
|
-
* @param rawData Raw ticker data from API
|
|
197
|
-
* @returns Processed Ticker object
|
|
198
|
-
*/
|
|
199
|
-
private processTickerData;
|
|
200
|
-
/**
|
|
201
|
-
* Get history orders (matches Java historyOrders)
|
|
202
|
-
* @param params History orders query parameters
|
|
203
|
-
*/
|
|
204
|
-
getHistoryOrders(params?: HistoryOrdersParams): Promise<SDKResponse<PageResponse<HistoryOrder>>>;
|
|
205
|
-
/**
|
|
206
|
-
* Get funding settlements history (matches Java fundingSettlements)
|
|
207
|
-
* @param params Funding settlements query parameters
|
|
208
|
-
*/
|
|
209
|
-
getFundingSettlements(params?: FundingSettlementsParams): Promise<SDKResponse<PageResponse<FundingSettlement>>>;
|
|
210
|
-
/**
|
|
211
|
-
* Get balance changes history (matches Java balanceChanges)
|
|
212
|
-
* @param params Balance changes query parameters
|
|
213
|
-
*/
|
|
214
|
-
getBalanceChanges(params?: BalanceChangesParams): Promise<SDKResponse<PageResponse<BalanceChange>>>;
|
|
215
|
-
/**
|
|
216
|
-
* Get oracle price for a trading pair (matches Java oracle)
|
|
217
|
-
* @param symbol Trading symbol (e.g., "BTC-PERP")
|
|
218
|
-
* @returns Oracle price as string (in wei/base unit)
|
|
219
|
-
*/
|
|
220
|
-
getOraclePrice(symbol: string): Promise<SDKResponse<string>>;
|
|
221
|
-
/**
|
|
222
|
-
* Add isolated margin to an existing position (on-chain)
|
|
223
|
-
* @param params Margin adjustment parameters
|
|
224
|
-
*/
|
|
225
|
-
addMargin(params: MarginAdjustmentParams): Promise<SuiTransactionBlockResponse>;
|
|
226
|
-
/**
|
|
227
|
-
* Remove isolated margin from an existing position (on-chain)
|
|
228
|
-
* @param params Margin adjustment parameters
|
|
229
|
-
*/
|
|
230
|
-
removeMargin(params: MarginAdjustmentParams): Promise<SuiTransactionBlockResponse>;
|
|
231
|
-
/**
|
|
232
|
-
* Build ExchangeOnChain call args for margin adjustments
|
|
233
|
-
*/
|
|
234
|
-
private buildMarginCallArgs;
|
|
235
|
-
private getDeploymentProtocolConfigId;
|
|
236
|
-
private buildMarginTransaction;
|
|
237
|
-
private buildUpdatePriceTransaction;
|
|
238
|
-
private buildMainnetPriceUpdateTransaction;
|
|
239
|
-
private buildTestnetPriceUpdateTransaction;
|
|
240
|
-
private getPriceInfoObjectId;
|
|
241
|
-
private getDeploymentMarket;
|
|
242
|
-
private resolvePriceFeedId;
|
|
243
|
-
private getCachedTradingPairs;
|
|
244
|
-
private ensurePythClients;
|
|
245
|
-
private extractOracleArrivalTime;
|
|
246
|
-
private extractClockTimeSeconds;
|
|
247
|
-
/**
|
|
248
|
-
* Resolve perpId from deployment data
|
|
249
|
-
*/
|
|
250
|
-
private resolvePerpIdFromDeployment;
|
|
251
|
-
/**
|
|
252
|
-
* Set sub-account on-chain (authorize a sub-account address)
|
|
253
|
-
* @param subAddress Sub-account address to authorize
|
|
254
|
-
* @returns On-chain transaction result
|
|
255
|
-
*/
|
|
256
|
-
setSubAccount(subAddress: string): Promise<SuiTransactionBlockResponse>;
|
|
257
|
-
/**
|
|
258
|
-
* Deposit to bank (fund account)
|
|
259
|
-
* Deposit USDC from wallet to exchange bank account for trading collateral
|
|
260
|
-
* @param amount Deposit amount in USDC (standard units, e.g., 10 means 10 USDC)
|
|
261
|
-
* @returns On-chain transaction result
|
|
262
|
-
* @example
|
|
263
|
-
* ```typescript
|
|
264
|
-
* const result = await sdk.depositToBank(100); // Deposit 100 USDC
|
|
265
|
-
* ```
|
|
266
|
-
*/
|
|
267
|
-
depositToBank(amount: number): Promise<SuiTransactionBlockResponse>;
|
|
268
|
-
/**
|
|
269
|
-
* Withdraw from bank (withdraw funds)
|
|
270
|
-
* Withdraw USDC from exchange bank account back to wallet
|
|
271
|
-
* @param amount Withdraw amount in USDC (standard units, e.g., 50 means 50 USDC)
|
|
272
|
-
* @returns On-chain transaction result
|
|
273
|
-
* @example
|
|
274
|
-
* ```typescript
|
|
275
|
-
* const result = await sdk.withdrawFromBank(50); // Withdraw 50 USDC
|
|
276
|
-
* ```
|
|
277
|
-
*/
|
|
278
|
-
withdrawFromBank(amount: number): Promise<SuiTransactionBlockResponse>;
|
|
279
|
-
/**
|
|
280
|
-
* Get all coin balances on-chain for the current wallet address
|
|
281
|
-
* @returns Array of coin balances with coinType and totalBalance
|
|
282
|
-
*/
|
|
283
|
-
getAllBalances(owner?: string): Promise<SDKResponse<{
|
|
284
|
-
coinType: string;
|
|
285
|
-
totalBalance: string;
|
|
286
|
-
}[]>>;
|
|
287
|
-
/**
|
|
288
|
-
* Get coin metadata (symbol, decimals, name) for a given coin type
|
|
289
|
-
* @param coinType Full coin type string (e.g., "0x2::sui::SUI")
|
|
290
|
-
*/
|
|
291
|
-
getCoinMetadata(coinType: string): Promise<SDKResponse<{
|
|
292
|
-
decimals: number;
|
|
293
|
-
symbol: string;
|
|
294
|
-
name: string;
|
|
295
|
-
}>>;
|
|
296
|
-
private getVaultPackageId;
|
|
297
|
-
private getVaultConfigId;
|
|
298
|
-
private getBankId;
|
|
299
|
-
private getTxIndexerId;
|
|
300
|
-
private getSubAccountsId;
|
|
301
|
-
private getCurrencyType;
|
|
302
|
-
private getMarketSymbols;
|
|
303
|
-
private getVaultPerpetualId;
|
|
304
|
-
private getVaultPriceInfoObjectId;
|
|
305
|
-
private buildVaultNavTransaction;
|
|
306
|
-
private signAndExecuteVaultTx;
|
|
307
|
-
/**
|
|
308
|
-
* Create a new on-chain vault
|
|
309
|
-
*/
|
|
310
|
-
createVault(args: {
|
|
311
|
-
name: string;
|
|
312
|
-
trader: string;
|
|
313
|
-
maxCap: number;
|
|
314
|
-
minDepositAmount: number;
|
|
315
|
-
creatorMinimumShareRatio: string;
|
|
316
|
-
creatorProfitShareRatio: string;
|
|
317
|
-
initialAmount: number;
|
|
318
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
319
|
-
/**
|
|
320
|
-
* Deposit USDC into a vault
|
|
321
|
-
*/
|
|
322
|
-
depositToVault(args: {
|
|
323
|
-
vaultID: string;
|
|
324
|
-
amount: number;
|
|
325
|
-
markets?: string[];
|
|
326
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
327
|
-
/**
|
|
328
|
-
* Request withdrawal from a vault (by share amount)
|
|
329
|
-
*/
|
|
330
|
-
requestWithdrawFromVault(args: {
|
|
331
|
-
vaultID: string;
|
|
332
|
-
shares: number;
|
|
333
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
334
|
-
/**
|
|
335
|
-
* Fill pending withdrawal requests (creator/operator only)
|
|
336
|
-
*/
|
|
337
|
-
fillWithdrawalRequests(args: {
|
|
338
|
-
vaultID: string;
|
|
339
|
-
withdrawalRequestIDs: string[];
|
|
340
|
-
markets?: string[];
|
|
341
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
342
|
-
/**
|
|
343
|
-
* Close a vault (creator only)
|
|
344
|
-
*/
|
|
345
|
-
closeVault(args: {
|
|
346
|
-
vaultID: string;
|
|
347
|
-
markets?: string[];
|
|
348
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
349
|
-
/**
|
|
350
|
-
* Remove a closed vault (after all funds claimed)
|
|
351
|
-
*/
|
|
352
|
-
removeVault(args: {
|
|
353
|
-
vaultID: string;
|
|
354
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
355
|
-
/**
|
|
356
|
-
* Claim funds from a closed vault
|
|
357
|
-
*/
|
|
358
|
-
claimClosedVaultFunds(args: {
|
|
359
|
-
vaultID: string;
|
|
360
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
361
|
-
/**
|
|
362
|
-
* Set the trader address for a vault (creator only)
|
|
363
|
-
*/
|
|
364
|
-
setVaultTrader(args: {
|
|
365
|
-
vaultID: string;
|
|
366
|
-
newTrader: string;
|
|
367
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
368
|
-
/**
|
|
369
|
-
* Add or remove a sub-trader for a vault
|
|
370
|
-
*/
|
|
371
|
-
setVaultSubTrader(args: {
|
|
372
|
-
vaultID: string;
|
|
373
|
-
subTrader: string;
|
|
374
|
-
status: boolean;
|
|
375
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
376
|
-
/**
|
|
377
|
-
* Enable or disable deposits to a vault (creator only)
|
|
378
|
-
*/
|
|
379
|
-
setVaultDepositStatus(args: {
|
|
380
|
-
vaultID: string;
|
|
381
|
-
status: boolean;
|
|
382
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
383
|
-
/**
|
|
384
|
-
* Set maximum USDC cap for a vault (creator only)
|
|
385
|
-
*/
|
|
386
|
-
setVaultMaxCap(args: {
|
|
387
|
-
vaultID: string;
|
|
388
|
-
maxCap: number;
|
|
389
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
390
|
-
/**
|
|
391
|
-
* Set minimum deposit amount for a vault (creator only)
|
|
392
|
-
*/
|
|
393
|
-
setVaultMinDepositAmount(args: {
|
|
394
|
-
vaultID: string;
|
|
395
|
-
minDepositAmount: number;
|
|
396
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
397
|
-
/**
|
|
398
|
-
* Enable or disable auto-close on withdrawal (creator only)
|
|
399
|
-
*/
|
|
400
|
-
setVaultAutoCloseOnWithdraw(args: {
|
|
401
|
-
vaultID: string;
|
|
402
|
-
autoCloseOnWithdraw: boolean;
|
|
403
|
-
}): Promise<SuiTransactionBlockResponse>;
|
|
404
|
-
/**
|
|
405
|
-
* Read vault object data from chain
|
|
406
|
-
*/
|
|
407
|
-
getVaultInfo(vaultID: string): Promise<SDKResponse<any>>;
|
|
408
|
-
/**
|
|
409
|
-
* List vaults created by a specific address via server API.
|
|
410
|
-
*/
|
|
411
|
-
listVaults(creatorAddress?: string): Promise<SDKResponse<any[]>>;
|
|
412
|
-
}
|
|
413
|
-
//# sourceMappingURL=sdk.d.ts.map
|