@continuumdao/ctm-mpc-defi 0.2.48 → 0.2.49
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/agent/catalog.cjs +1083 -4
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +1191 -7
- package/dist/agent/catalog.js +1047 -5
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/derive/SKILL.md +112 -0
- package/dist/agent/skills/hyperliquid/SKILL.md +22 -2
- package/dist/chains/evm/index.d.ts +118 -6
- package/dist/chains/near/index.d.ts +7 -1
- package/dist/chains/solana/index.d.ts +7 -1
- package/dist/core/index.cjs +2 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +138 -7
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +848 -16
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +600 -6
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +125 -5
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/arcus/index.d.ts +66 -2
- package/dist/protocols/evm/circle-cctp/index.d.ts +71 -2
- package/dist/protocols/evm/compound-v3/index.d.ts +52 -1
- package/dist/protocols/evm/continuum-dao/index.d.ts +56 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +66 -2
- package/dist/protocols/evm/derive/index.cjs +2655 -0
- package/dist/protocols/evm/derive/index.cjs.map +1 -0
- package/dist/protocols/evm/derive/index.d.ts +859 -0
- package/dist/protocols/evm/derive/index.js +2536 -0
- package/dist/protocols/evm/derive/index.js.map +1 -0
- package/dist/protocols/evm/ethena/index.d.ts +52 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +115 -16
- package/dist/protocols/evm/gmx/index.d.ts +66 -2
- package/dist/protocols/evm/hyperliquid/index.cjs +545 -267
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +152 -7
- package/dist/protocols/evm/hyperliquid/index.js +535 -269
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.d.ts +52 -1
- package/dist/protocols/evm/maple/index.d.ts +52 -1
- package/dist/protocols/evm/morpho/index.d.ts +115 -4
- package/dist/protocols/evm/pendle/index.cjs +2 -1
- package/dist/protocols/evm/pendle/index.cjs.map +1 -1
- package/dist/protocols/evm/pendle/index.d.ts +125 -5
- package/dist/protocols/evm/pendle/index.js +2 -1
- package/dist/protocols/evm/pendle/index.js.map +1 -1
- package/dist/protocols/evm/permit2/index.d.ts +14 -1
- package/dist/protocols/evm/sky/index.d.ts +52 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +78 -4
- package/dist/protocols/evm/venice/index.d.ts +52 -1
- package/package.json +7 -2
- package/dist/buildBatch-tsEUVn_a.d.ts +0 -45
- package/dist/eip712Multisign-6oNIlObj.d.ts +0 -39
- package/dist/envelope-Cm-llShH.d.ts +0 -37
- package/dist/merklDistributor-CdqtZC9N.d.ts +0 -65
- package/dist/multisign-Dr0j9fHm.d.ts +0 -489
- package/dist/registry-BvsXh0-r.d.ts +0 -8
- package/dist/types-RJpoU4Pc.d.ts +0 -34
- package/dist/types-lIfv59N1.d.ts +0 -63
|
@@ -0,0 +1,859 @@
|
|
|
1
|
+
import { TypedDataDomain, Hex, Address } from 'viem';
|
|
2
|
+
|
|
3
|
+
/** Aligns with app NonEvmChainType + 'evm'. Extend as mpc-auth adds chains. */
|
|
4
|
+
type ChainCategory = 'evm' | 'solana' | 'near' | 'sui' | 'ton' | 'stellar';
|
|
5
|
+
type MultisignBuildResult = {
|
|
6
|
+
bodyForSign: Record<string, unknown>;
|
|
7
|
+
messageToSign: string;
|
|
8
|
+
};
|
|
9
|
+
type EvmTokenKind = 'native' | 'erc20' | 'erc721' | 'ctmerc20' | 'ctmrwa1';
|
|
10
|
+
type SolanaTokenKind = 'native' | 'spl' | 'spl2022';
|
|
11
|
+
type NearTokenKind = 'native' | 'nep141';
|
|
12
|
+
type TokenRef = {
|
|
13
|
+
category: 'evm';
|
|
14
|
+
kind: EvmTokenKind;
|
|
15
|
+
address: `0x${string}`;
|
|
16
|
+
} | {
|
|
17
|
+
category: 'solana';
|
|
18
|
+
kind: SolanaTokenKind;
|
|
19
|
+
mint: string;
|
|
20
|
+
} | {
|
|
21
|
+
category: 'near';
|
|
22
|
+
kind: NearTokenKind;
|
|
23
|
+
contractId: string;
|
|
24
|
+
};
|
|
25
|
+
type ParamDoc = {
|
|
26
|
+
type: string;
|
|
27
|
+
required: boolean;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
type ProtocolActionDescriptor = {
|
|
31
|
+
id: string;
|
|
32
|
+
protocolId: string;
|
|
33
|
+
chainCategory: ChainCategory;
|
|
34
|
+
description: string;
|
|
35
|
+
commonParams: Array<'keyGen' | 'purposeText' | 'useCustomGas' | 'useCustomFees'>;
|
|
36
|
+
params: Record<string, ParamDoc>;
|
|
37
|
+
};
|
|
38
|
+
type ChainSupportContext = {
|
|
39
|
+
chainCategory: ChainCategory;
|
|
40
|
+
chainId: string | number;
|
|
41
|
+
};
|
|
42
|
+
interface ProtocolModule {
|
|
43
|
+
id: string;
|
|
44
|
+
chainCategory: ChainCategory;
|
|
45
|
+
isChainSupported(ctx: ChainSupportContext): boolean | Promise<boolean>;
|
|
46
|
+
isTokenSupported(token: TokenRef): boolean | Promise<boolean>;
|
|
47
|
+
actions: ProtocolActionDescriptor[];
|
|
48
|
+
}
|
|
49
|
+
type KeyGenSubset = {
|
|
50
|
+
pubkeyhex?: string;
|
|
51
|
+
keylist?: string[];
|
|
52
|
+
ClientKeys?: Record<string, string>;
|
|
53
|
+
groupId?: string;
|
|
54
|
+
GroupId?: string;
|
|
55
|
+
};
|
|
56
|
+
/** App-compatible alias used by multisign builders and Permit2 helpers. */
|
|
57
|
+
type KeyGenSubsetForPermit = KeyGenSubset;
|
|
58
|
+
|
|
59
|
+
declare const DERIVE_PROTOCOL_ID: "derive";
|
|
60
|
+
declare const DERIVE_MATCHING_VERIFYING_CONTRACT: "0xeB8d770ec18DB98Db922E9D83260A585b9F0DeAD";
|
|
61
|
+
/** keccak256("Action(uint256 subaccountId,uint256 nonce,address module,bytes data,uint256 expiry,address owner,address signer)") */
|
|
62
|
+
declare const DERIVE_ACTION_TYPEHASH: "0x4d7a9f27c403ff9c0f19bce61d76d82f9aa29f8d6d4b0c5474607d9770d1af17";
|
|
63
|
+
declare const DERIVE_TRADE_MODULE: "0xB8D20c2B7a1Ad2EE33Bc50eF10876eD3035b5e7b";
|
|
64
|
+
declare const DERIVE_TRANSFER_MODULE: "0x01259207A40925b794C8ac320456F7F6c8FE2636";
|
|
65
|
+
declare const DERIVE_DOMAIN_SEPARATOR_MAINNET: "0xda616dfabb88681b08e1592820a41d55ddc62d68de110e327ae99d734506fe19";
|
|
66
|
+
declare const DERIVE_DOMAIN_SEPARATOR_TESTNET: "0x24d674cd5f2b9d564691c51e9d88f649b99246a2244dd74ce27b96578d773e85";
|
|
67
|
+
declare const DERIVE_MAINNET_API = "https://api.derive.xyz/v3";
|
|
68
|
+
declare const DERIVE_TESTNET_API = "https://testnet.api.derive.xyz/v3";
|
|
69
|
+
/** Live production REST. v3 mainnet currently ‑32603s catalog methods that still work here. */
|
|
70
|
+
declare const DERIVE_MAINNET_API_V2 = "https://api.lyra.finance";
|
|
71
|
+
declare const DERIVE_TESTNET_API_V2 = "https://api-demo.lyra.finance";
|
|
72
|
+
/** Sepolia OnchainActionManager. Mainnet is still unpublished — override via env or builder arg. */
|
|
73
|
+
declare const DERIVE_ACTION_MANAGER_TESTNET: "0xd3625eCf97E5554C62A48Ac1c9284C9dCeFceB68";
|
|
74
|
+
declare const DERIVE_EIP712_NAME = "Matching";
|
|
75
|
+
declare const DERIVE_EIP712_VERSION = "1.0";
|
|
76
|
+
declare const DERIVE_DEFAULT_SIGNATURE_EXPIRY_SEC = 300;
|
|
77
|
+
declare const DERIVE_MIN_ORDER_EXPIRY_SEC = 10;
|
|
78
|
+
declare const DERIVE_OHLCV_INTERVALS: readonly ["1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w"];
|
|
79
|
+
type DeriveOhlcvInterval = (typeof DERIVE_OHLCV_INTERVALS)[number];
|
|
80
|
+
declare const DERIVE_OHLCV_PERIOD_SEC: Record<DeriveOhlcvInterval, number>;
|
|
81
|
+
declare const DERIVE_DEFAULT_OHLCV_INTERVAL: DeriveOhlcvInterval;
|
|
82
|
+
/** Default window when the caller omits lookback — enough for a dialog chart, not a full history dump. */
|
|
83
|
+
declare const DERIVE_DEFAULT_OHLCV_BARS = 96;
|
|
84
|
+
/** Default strike/premium ladder: ATM window, same width as the Trade-tab table. */
|
|
85
|
+
declare const DERIVE_DEFAULT_TICKER_ATM_STRIKES = 9;
|
|
86
|
+
declare const DERIVE_DEFAULT_LOOKBACK_DAYS = 2;
|
|
87
|
+
declare const DERIVE_MAX_LOOKBACK_DAYS = 90;
|
|
88
|
+
declare const DERIVE_MAX_OHLCV_BARS = 2000;
|
|
89
|
+
declare const DERIVE_UNFUNDED_NOTES = "No Derive subaccount on this KeyGen. Fund from a logo row: Ethereum L1 USDC/WETH/WBTC (ctm_derive_build_deposit_new_subaccount_multisign or register_deposit_address + transfer), Socket USDC/WETH/WBTC on Optimism/Base/Arbitrum (ctm_derive_build_socket_deposit_multisign), or HyperEVM HYPE (ctm_derive_build_hype_vault_deposit_multisign). After credit, EIP-712 orders use Derive collateral.";
|
|
90
|
+
declare const DERIVE_UNFUNDED_NEXT: readonly ["ctm_derive_fetch_risk_universes", "ctm_derive_build_deposit_new_subaccount_multisign", "ctm_derive_register_deposit_address", "ctm_derive_build_socket_deposit_multisign", "ctm_derive_build_hype_vault_deposit_multisign"];
|
|
91
|
+
declare const DERIVE_MISSING_SUBACCOUNT_ERROR = "subaccountId is required and must come from ctm_derive_fetch_subaccounts. If that list is empty, fund from a Derive logo row (Ethereum L1, Socket on OP/Base/Arb, or HyperEVM HYPE). Do not use subaccount_id 0 for orders.";
|
|
92
|
+
|
|
93
|
+
/** Settlement chain for EIP-712 domain + Direct deposit. */
|
|
94
|
+
declare const DERIVE_SETTLEMENT_CHAIN_IDS: readonly [1, 11155111];
|
|
95
|
+
type DeriveNetwork = 'mainnet' | 'testnet';
|
|
96
|
+
declare function deriveNetworkFromChainId(chainId: number): DeriveNetwork;
|
|
97
|
+
declare function deriveSettlementChainId(network: DeriveNetwork): number;
|
|
98
|
+
declare function deriveApiBaseUrl(network?: DeriveNetwork): string;
|
|
99
|
+
/** Production REST used when v3 public catalog methods ‑32603 / 404 / return empty. */
|
|
100
|
+
declare function deriveApiFallbackBaseUrl(network?: DeriveNetwork): string;
|
|
101
|
+
declare function deriveApiBaseUrlForChainId(chainId: number): string;
|
|
102
|
+
declare function deriveActionManagerAddress(chainId: number, override?: string): `0x${string}`;
|
|
103
|
+
declare function isDeriveSettlementChainId(chainId: number): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Asset-row chains that can actually fund Derive (Hyperliquid-shaped).
|
|
106
|
+
* Ethereum L1 direct / deposit-address, Socket on OP/Base/Arb, HYPE vault on HyperEVM.
|
|
107
|
+
*/
|
|
108
|
+
declare const DERIVE_ASSET_ROW_CHAIN_IDS: readonly [1, 10, 8453, 42161, 999, 11155111];
|
|
109
|
+
declare function isDeriveAssetRowChainId(chainId: number): boolean;
|
|
110
|
+
declare function isDeriveChainSupported(chainId: number): boolean;
|
|
111
|
+
declare const NATIVE_ZERO: "0x0000000000000000000000000000000000000000";
|
|
112
|
+
type TokenRow = {
|
|
113
|
+
address: `0x${string}`;
|
|
114
|
+
symbol: string;
|
|
115
|
+
decimals: number;
|
|
116
|
+
roles: string[];
|
|
117
|
+
};
|
|
118
|
+
/** Per-chain token rows that can fund Derive (Socket / L1 / HYPE vault). */
|
|
119
|
+
declare function deriveMappedTokensForChain(chainId: number): TokenRow[];
|
|
120
|
+
declare function deriveNativeWrappedForChain(chainId: number): string | undefined;
|
|
121
|
+
declare function deriveAdvisorNotes(): string;
|
|
122
|
+
|
|
123
|
+
/** Map a node asset-row address to the Derive advisor lookup key (native gas → wrapped). */
|
|
124
|
+
declare function deriveKeyForNodeAssetRow(args: {
|
|
125
|
+
contractAddress: string;
|
|
126
|
+
nativeWrapped?: string | null;
|
|
127
|
+
}): string | null;
|
|
128
|
+
|
|
129
|
+
type DeriveAuth = {
|
|
130
|
+
wallet: string;
|
|
131
|
+
timestamp: string;
|
|
132
|
+
signature: string;
|
|
133
|
+
};
|
|
134
|
+
type DeriveRpcError = {
|
|
135
|
+
code?: number;
|
|
136
|
+
message?: string;
|
|
137
|
+
data?: unknown;
|
|
138
|
+
};
|
|
139
|
+
declare function isDerivePublicMethod(method: string): boolean;
|
|
140
|
+
declare function isEmptyDerivePublicResult(method: string, result: unknown): boolean;
|
|
141
|
+
declare function isDeriveRecoverablePublicError(err: unknown): boolean;
|
|
142
|
+
declare function deriveRpc<T>(args: {
|
|
143
|
+
method: string;
|
|
144
|
+
params?: Record<string, unknown>;
|
|
145
|
+
network?: DeriveNetwork;
|
|
146
|
+
auth?: DeriveAuth;
|
|
147
|
+
}): Promise<T>;
|
|
148
|
+
declare function requireDeriveAuth(auth: DeriveAuth | undefined, toolHint: string): DeriveAuth;
|
|
149
|
+
|
|
150
|
+
type DeriveInstrument = {
|
|
151
|
+
instrument_name: string;
|
|
152
|
+
instrument_type?: string;
|
|
153
|
+
base_asset_address?: string;
|
|
154
|
+
base_asset_sub_id?: string;
|
|
155
|
+
is_active?: boolean;
|
|
156
|
+
option_details?: {
|
|
157
|
+
expiry?: number;
|
|
158
|
+
strike?: string;
|
|
159
|
+
option_type?: string;
|
|
160
|
+
};
|
|
161
|
+
[key: string]: unknown;
|
|
162
|
+
};
|
|
163
|
+
type DeriveCurrencyManager = {
|
|
164
|
+
address?: string;
|
|
165
|
+
margin_type?: string;
|
|
166
|
+
currency?: string | null;
|
|
167
|
+
manager_id?: number;
|
|
168
|
+
};
|
|
169
|
+
type DeriveCurrency = {
|
|
170
|
+
currency: string;
|
|
171
|
+
instrument_types?: string[];
|
|
172
|
+
protocol_asset_addresses?: {
|
|
173
|
+
option?: string | null;
|
|
174
|
+
perp?: string | null;
|
|
175
|
+
spot?: string | null;
|
|
176
|
+
underlying_erc20?: string | null;
|
|
177
|
+
};
|
|
178
|
+
managers?: DeriveCurrencyManager[];
|
|
179
|
+
spot?: Array<{
|
|
180
|
+
erc20?: {
|
|
181
|
+
underlying_erc20?: string;
|
|
182
|
+
decimals?: number;
|
|
183
|
+
};
|
|
184
|
+
}>;
|
|
185
|
+
[key: string]: unknown;
|
|
186
|
+
};
|
|
187
|
+
declare function deriveFetchInstrument(args: {
|
|
188
|
+
instrumentName: string;
|
|
189
|
+
network?: DeriveNetwork;
|
|
190
|
+
}): Promise<DeriveInstrument>;
|
|
191
|
+
declare function deriveFetchCurrenciesRaw(args?: {
|
|
192
|
+
network?: DeriveNetwork;
|
|
193
|
+
}): Promise<DeriveCurrency[]>;
|
|
194
|
+
declare function deriveFetchOptionInstruments(args: {
|
|
195
|
+
currency: string;
|
|
196
|
+
expired?: boolean;
|
|
197
|
+
page?: number;
|
|
198
|
+
pageSize?: number;
|
|
199
|
+
network?: DeriveNetwork;
|
|
200
|
+
}): Promise<{
|
|
201
|
+
instruments: DeriveInstrument[];
|
|
202
|
+
}>;
|
|
203
|
+
declare function deriveSearchInstruments(instruments: DeriveInstrument[], query: string, limit?: number): DeriveInstrument[];
|
|
204
|
+
|
|
205
|
+
type DeriveOhlcvCandle = {
|
|
206
|
+
timestampMs: number;
|
|
207
|
+
open: string;
|
|
208
|
+
high: string;
|
|
209
|
+
low: string;
|
|
210
|
+
close: string;
|
|
211
|
+
volume: string;
|
|
212
|
+
};
|
|
213
|
+
declare function resolveDeriveOhlcvWindow(args: {
|
|
214
|
+
interval: DeriveOhlcvInterval;
|
|
215
|
+
lookbackDays?: number;
|
|
216
|
+
lookbackHours?: number;
|
|
217
|
+
startTimeMs?: number;
|
|
218
|
+
endTimeMs?: number;
|
|
219
|
+
}): {
|
|
220
|
+
startTimeMs: number;
|
|
221
|
+
endTimeMs: number;
|
|
222
|
+
expectedBars: number;
|
|
223
|
+
periodSec: number;
|
|
224
|
+
};
|
|
225
|
+
declare function mapDeriveTradingviewCandles(raw: unknown): DeriveOhlcvCandle[];
|
|
226
|
+
type DeriveOptionType = 'C' | 'P';
|
|
227
|
+
type DeriveParsedInstrumentName = {
|
|
228
|
+
currency: string;
|
|
229
|
+
expiryYmd: string;
|
|
230
|
+
strike: string;
|
|
231
|
+
optionType: DeriveOptionType;
|
|
232
|
+
};
|
|
233
|
+
declare function deriveParseInstrumentName(name: string): DeriveParsedInstrumentName | null;
|
|
234
|
+
declare function deriveExpiryUnixToYmd(expirySec: number): string;
|
|
235
|
+
type DeriveTickerQuote = {
|
|
236
|
+
instrumentName: string;
|
|
237
|
+
bidPx: string | null;
|
|
238
|
+
askPx: string | null;
|
|
239
|
+
markPx: string | null;
|
|
240
|
+
indexPx: string | null;
|
|
241
|
+
strike: string | null;
|
|
242
|
+
expiry: number | null;
|
|
243
|
+
expiryYmd: string | null;
|
|
244
|
+
optionType: DeriveOptionType | null;
|
|
245
|
+
greeks: Record<string, unknown> | null;
|
|
246
|
+
};
|
|
247
|
+
declare function mapDeriveTickerRow(raw: unknown): DeriveTickerQuote | null;
|
|
248
|
+
declare function collectDeriveTickerRows(raw: unknown): unknown[];
|
|
249
|
+
declare function normalizeDeriveExpiryYmd(raw: unknown): string;
|
|
250
|
+
declare function deriveAtmTickerWindow(tickers: DeriveTickerQuote[], maxStrikes?: number): DeriveTickerQuote[];
|
|
251
|
+
declare function deriveFetchTickersSummary(args: {
|
|
252
|
+
chainId?: number;
|
|
253
|
+
network?: DeriveNetwork;
|
|
254
|
+
currency: string;
|
|
255
|
+
expiryDate: string | number;
|
|
256
|
+
optionType?: DeriveOptionType;
|
|
257
|
+
ladder?: 'atm' | 'all';
|
|
258
|
+
}): Promise<{
|
|
259
|
+
currency: string;
|
|
260
|
+
expiryDate: string;
|
|
261
|
+
optionType: DeriveOptionType | null;
|
|
262
|
+
ladder: "atm" | "all";
|
|
263
|
+
indexPx: string | null;
|
|
264
|
+
listedCount: number;
|
|
265
|
+
tickerCount: number;
|
|
266
|
+
callCount: number;
|
|
267
|
+
putCount: number;
|
|
268
|
+
tickers: DeriveTickerQuote[];
|
|
269
|
+
notes: string;
|
|
270
|
+
network: DeriveNetwork;
|
|
271
|
+
}>;
|
|
272
|
+
type DeriveOrderBookLevel = {
|
|
273
|
+
price: string;
|
|
274
|
+
amount: string;
|
|
275
|
+
};
|
|
276
|
+
declare function mapDeriveOrderBookLevels(raw: unknown): DeriveOrderBookLevel[];
|
|
277
|
+
declare function deriveFetchOrderBookSummary(args: {
|
|
278
|
+
chainId?: number;
|
|
279
|
+
network?: DeriveNetwork;
|
|
280
|
+
instrumentName: string;
|
|
281
|
+
depth?: number;
|
|
282
|
+
}): Promise<{
|
|
283
|
+
instrumentName: string;
|
|
284
|
+
bids: DeriveOrderBookLevel[];
|
|
285
|
+
asks: DeriveOrderBookLevel[];
|
|
286
|
+
network: DeriveNetwork;
|
|
287
|
+
}>;
|
|
288
|
+
declare function deriveFetchCurrenciesSummary(args: {
|
|
289
|
+
chainId?: number;
|
|
290
|
+
network?: DeriveNetwork;
|
|
291
|
+
}): Promise<{
|
|
292
|
+
currencies: {
|
|
293
|
+
currency: string;
|
|
294
|
+
}[];
|
|
295
|
+
network: DeriveNetwork;
|
|
296
|
+
}>;
|
|
297
|
+
type DeriveMappedOptionInstrument = {
|
|
298
|
+
instrumentName: string;
|
|
299
|
+
instrumentType: string;
|
|
300
|
+
isActive: boolean;
|
|
301
|
+
strike: string | null;
|
|
302
|
+
expiry: number | null;
|
|
303
|
+
optionType: string | null;
|
|
304
|
+
};
|
|
305
|
+
type DeriveOptionExpirySummary = {
|
|
306
|
+
expiryYmd: string;
|
|
307
|
+
expiryUnix: number | null;
|
|
308
|
+
callCount: number;
|
|
309
|
+
putCount: number;
|
|
310
|
+
minStrike: string | null;
|
|
311
|
+
maxStrike: string | null;
|
|
312
|
+
};
|
|
313
|
+
declare function summarizeDeriveOptionChain(args: {
|
|
314
|
+
currency: string;
|
|
315
|
+
instruments: DeriveMappedOptionInstrument[];
|
|
316
|
+
}): {
|
|
317
|
+
currency: string;
|
|
318
|
+
instrumentCount: number;
|
|
319
|
+
callCount: number;
|
|
320
|
+
putCount: number;
|
|
321
|
+
expiries: DeriveOptionExpirySummary[];
|
|
322
|
+
};
|
|
323
|
+
declare function deriveFetchOptionChainSummary(args: {
|
|
324
|
+
chainId?: number;
|
|
325
|
+
network?: DeriveNetwork;
|
|
326
|
+
currency: string;
|
|
327
|
+
expired?: boolean;
|
|
328
|
+
}): Promise<{
|
|
329
|
+
currency: string;
|
|
330
|
+
instruments: {
|
|
331
|
+
instrumentName: string;
|
|
332
|
+
instrumentType: string;
|
|
333
|
+
isActive: boolean;
|
|
334
|
+
strike: string | null;
|
|
335
|
+
expiry: number | null;
|
|
336
|
+
optionType: DeriveOptionType | null;
|
|
337
|
+
}[];
|
|
338
|
+
network: DeriveNetwork;
|
|
339
|
+
}>;
|
|
340
|
+
/** Compact expiry ladder for the agent — do not dump every instrument (offloads + bash). */
|
|
341
|
+
declare function deriveFetchOptionChainAgentSummary(args: {
|
|
342
|
+
chainId?: number;
|
|
343
|
+
network?: DeriveNetwork;
|
|
344
|
+
currency: string;
|
|
345
|
+
expired?: boolean;
|
|
346
|
+
}): Promise<{
|
|
347
|
+
notes: string;
|
|
348
|
+
network: DeriveNetwork;
|
|
349
|
+
currency: string;
|
|
350
|
+
instrumentCount: number;
|
|
351
|
+
callCount: number;
|
|
352
|
+
putCount: number;
|
|
353
|
+
expiries: DeriveOptionExpirySummary[];
|
|
354
|
+
}>;
|
|
355
|
+
declare function deriveSearchInstrumentsSummary(args: {
|
|
356
|
+
chainId?: number;
|
|
357
|
+
network?: DeriveNetwork;
|
|
358
|
+
currency: string;
|
|
359
|
+
query: string;
|
|
360
|
+
limit?: number;
|
|
361
|
+
}): Promise<{
|
|
362
|
+
instruments: {
|
|
363
|
+
instrumentName: string;
|
|
364
|
+
}[];
|
|
365
|
+
network: DeriveNetwork;
|
|
366
|
+
}>;
|
|
367
|
+
declare function deriveFetchMarketSnapshotSummary(args: {
|
|
368
|
+
chainId?: number;
|
|
369
|
+
network?: DeriveNetwork;
|
|
370
|
+
instrumentName: string;
|
|
371
|
+
}): Promise<{
|
|
372
|
+
snapshot: {
|
|
373
|
+
instrumentName: string;
|
|
374
|
+
livePrice: {
|
|
375
|
+
markPx: string | null;
|
|
376
|
+
indexPx: string | null;
|
|
377
|
+
bidPx: string | null;
|
|
378
|
+
askPx: string | null;
|
|
379
|
+
midUsd: string;
|
|
380
|
+
source: string;
|
|
381
|
+
};
|
|
382
|
+
greeks: {} | null;
|
|
383
|
+
fetchedAtMs: number;
|
|
384
|
+
};
|
|
385
|
+
network: DeriveNetwork;
|
|
386
|
+
}>;
|
|
387
|
+
declare function deriveFetchOhlcvSummary(args: {
|
|
388
|
+
chainId?: number;
|
|
389
|
+
network?: DeriveNetwork;
|
|
390
|
+
instrumentName?: string;
|
|
391
|
+
currency?: string;
|
|
392
|
+
marketKind?: 'option' | 'index';
|
|
393
|
+
interval?: string;
|
|
394
|
+
lookbackDays?: number;
|
|
395
|
+
lookbackHours?: number;
|
|
396
|
+
startTimeMs?: number;
|
|
397
|
+
endTimeMs?: number;
|
|
398
|
+
}): Promise<{
|
|
399
|
+
ohlcv: {
|
|
400
|
+
market: string;
|
|
401
|
+
coin: string;
|
|
402
|
+
interval: "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "1d" | "1w";
|
|
403
|
+
marketKind: "option" | "index";
|
|
404
|
+
startTimeMs: number;
|
|
405
|
+
endTimeMs: number;
|
|
406
|
+
expectedBars: number;
|
|
407
|
+
candleCount: number;
|
|
408
|
+
latestCandle: DeriveOhlcvCandle;
|
|
409
|
+
candles: DeriveOhlcvCandle[];
|
|
410
|
+
fetchedAtMs: number;
|
|
411
|
+
dataSource: "derive";
|
|
412
|
+
};
|
|
413
|
+
dataSource: "derive";
|
|
414
|
+
network: DeriveNetwork;
|
|
415
|
+
}>;
|
|
416
|
+
declare function deriveOrderQuoteSummary(args: {
|
|
417
|
+
chainId?: number;
|
|
418
|
+
network?: DeriveNetwork;
|
|
419
|
+
instrumentName: string;
|
|
420
|
+
direction: 'buy' | 'sell';
|
|
421
|
+
amount: string;
|
|
422
|
+
limitPrice: string;
|
|
423
|
+
subaccountId?: number;
|
|
424
|
+
}): Promise<{
|
|
425
|
+
quote: Record<string, unknown>;
|
|
426
|
+
instrumentName: string;
|
|
427
|
+
network: DeriveNetwork;
|
|
428
|
+
}>;
|
|
429
|
+
declare function synthesizeDeriveRiskUniversesFromCurrencies(currencies: DeriveCurrency[]): {
|
|
430
|
+
risk_universe_id: null;
|
|
431
|
+
source: string;
|
|
432
|
+
managers: {
|
|
433
|
+
manager_id: number | null;
|
|
434
|
+
address: string;
|
|
435
|
+
margin_type: string | null;
|
|
436
|
+
currency: string | null;
|
|
437
|
+
instrument_types: string[];
|
|
438
|
+
collaterals: Array<{
|
|
439
|
+
name: string;
|
|
440
|
+
address: string | null;
|
|
441
|
+
erc20: {
|
|
442
|
+
underlying_erc20: string | null;
|
|
443
|
+
};
|
|
444
|
+
}>;
|
|
445
|
+
}[];
|
|
446
|
+
}[];
|
|
447
|
+
declare function deriveFetchRiskUniversesSummary(args: {
|
|
448
|
+
chainId?: number;
|
|
449
|
+
network?: DeriveNetwork;
|
|
450
|
+
}): Promise<{
|
|
451
|
+
universes: any[];
|
|
452
|
+
notes: string;
|
|
453
|
+
network: DeriveNetwork;
|
|
454
|
+
}>;
|
|
455
|
+
declare function deriveFetchPendingDepositsSummary(args: {
|
|
456
|
+
chainId?: number;
|
|
457
|
+
network?: DeriveNetwork;
|
|
458
|
+
wallet?: string;
|
|
459
|
+
executorAddress?: string;
|
|
460
|
+
}): Promise<{
|
|
461
|
+
pending: any[];
|
|
462
|
+
credited: boolean;
|
|
463
|
+
notes: string;
|
|
464
|
+
network: DeriveNetwork;
|
|
465
|
+
}>;
|
|
466
|
+
|
|
467
|
+
declare function deriveEmptySubaccountsPayload(wallet: string): {
|
|
468
|
+
wallet: string;
|
|
469
|
+
subaccounts: number[];
|
|
470
|
+
funded: false;
|
|
471
|
+
notes: string;
|
|
472
|
+
next: ("ctm_derive_fetch_risk_universes" | "ctm_derive_build_deposit_new_subaccount_multisign" | "ctm_derive_register_deposit_address" | "ctm_derive_build_socket_deposit_multisign" | "ctm_derive_build_hype_vault_deposit_multisign")[];
|
|
473
|
+
};
|
|
474
|
+
declare function deriveFetchSubaccountsSummary(args: {
|
|
475
|
+
chainId?: number;
|
|
476
|
+
network?: DeriveNetwork;
|
|
477
|
+
wallet?: string;
|
|
478
|
+
executorAddress?: string;
|
|
479
|
+
auth?: DeriveAuth;
|
|
480
|
+
}): Promise<{
|
|
481
|
+
network: DeriveNetwork;
|
|
482
|
+
wallet: string;
|
|
483
|
+
subaccounts: number[];
|
|
484
|
+
funded: false;
|
|
485
|
+
notes: string;
|
|
486
|
+
next: ("ctm_derive_fetch_risk_universes" | "ctm_derive_build_deposit_new_subaccount_multisign" | "ctm_derive_register_deposit_address" | "ctm_derive_build_socket_deposit_multisign" | "ctm_derive_build_hype_vault_deposit_multisign")[];
|
|
487
|
+
} | {
|
|
488
|
+
wallet: `0x${string}`;
|
|
489
|
+
subaccounts: number[];
|
|
490
|
+
funded: true;
|
|
491
|
+
notes: string;
|
|
492
|
+
next: string[];
|
|
493
|
+
network: DeriveNetwork;
|
|
494
|
+
}>;
|
|
495
|
+
declare function deriveFetchPortfolioSummary(args: {
|
|
496
|
+
chainId?: number;
|
|
497
|
+
network?: DeriveNetwork;
|
|
498
|
+
wallet?: string;
|
|
499
|
+
executorAddress?: string;
|
|
500
|
+
subaccountId: number;
|
|
501
|
+
auth?: DeriveAuth;
|
|
502
|
+
}): Promise<{
|
|
503
|
+
portfolio: unknown;
|
|
504
|
+
subaccountId: number;
|
|
505
|
+
wallet: `0x${string}`;
|
|
506
|
+
network: DeriveNetwork;
|
|
507
|
+
}>;
|
|
508
|
+
declare function deriveFetchPositionsSummary(args: {
|
|
509
|
+
chainId?: number;
|
|
510
|
+
network?: DeriveNetwork;
|
|
511
|
+
wallet?: string;
|
|
512
|
+
executorAddress?: string;
|
|
513
|
+
subaccountId: number;
|
|
514
|
+
auth?: DeriveAuth;
|
|
515
|
+
}): Promise<{
|
|
516
|
+
positions: unknown[];
|
|
517
|
+
subaccountId: number;
|
|
518
|
+
wallet: `0x${string}`;
|
|
519
|
+
network: DeriveNetwork;
|
|
520
|
+
}>;
|
|
521
|
+
declare function deriveFetchOpenOrdersSummary(args: {
|
|
522
|
+
chainId?: number;
|
|
523
|
+
network?: DeriveNetwork;
|
|
524
|
+
wallet?: string;
|
|
525
|
+
executorAddress?: string;
|
|
526
|
+
subaccountId: number;
|
|
527
|
+
auth?: DeriveAuth;
|
|
528
|
+
}): Promise<{
|
|
529
|
+
orders: unknown[];
|
|
530
|
+
subaccountId: number;
|
|
531
|
+
wallet: `0x${string}`;
|
|
532
|
+
network: DeriveNetwork;
|
|
533
|
+
}>;
|
|
534
|
+
|
|
535
|
+
type Eip712TypedDataField = {
|
|
536
|
+
name: string;
|
|
537
|
+
type: string;
|
|
538
|
+
};
|
|
539
|
+
type Eip712TypedDataPayload = {
|
|
540
|
+
domain: TypedDataDomain;
|
|
541
|
+
types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>;
|
|
542
|
+
primaryType: string;
|
|
543
|
+
message: Record<string, unknown>;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
declare const DERIVE_ACTION_TYPES: {
|
|
547
|
+
readonly Action: readonly [{
|
|
548
|
+
readonly name: "subaccountId";
|
|
549
|
+
readonly type: "uint256";
|
|
550
|
+
}, {
|
|
551
|
+
readonly name: "nonce";
|
|
552
|
+
readonly type: "uint256";
|
|
553
|
+
}, {
|
|
554
|
+
readonly name: "module";
|
|
555
|
+
readonly type: "address";
|
|
556
|
+
}, {
|
|
557
|
+
readonly name: "data";
|
|
558
|
+
readonly type: "bytes";
|
|
559
|
+
}, {
|
|
560
|
+
readonly name: "expiry";
|
|
561
|
+
readonly type: "uint256";
|
|
562
|
+
}, {
|
|
563
|
+
readonly name: "owner";
|
|
564
|
+
readonly type: "address";
|
|
565
|
+
}, {
|
|
566
|
+
readonly name: "signer";
|
|
567
|
+
readonly type: "address";
|
|
568
|
+
}];
|
|
569
|
+
};
|
|
570
|
+
declare function deriveE18(value: string, field: string): bigint;
|
|
571
|
+
/** UTC-nanosecond nonce as a decimal string (ms * 1e6 + random 6 digits). */
|
|
572
|
+
declare function deriveRandomNonce(nowMs?: number): string;
|
|
573
|
+
declare function deriveExpirySec(secondsFromNow?: number, nowMs?: number): number;
|
|
574
|
+
declare function deriveMatchingDomain(network: DeriveNetwork): {
|
|
575
|
+
name: string;
|
|
576
|
+
version: string;
|
|
577
|
+
chainId: bigint;
|
|
578
|
+
verifyingContract: Address;
|
|
579
|
+
};
|
|
580
|
+
declare function deriveDomainSeparator(network: DeriveNetwork): Hex;
|
|
581
|
+
declare function encodeDeriveTradeData(args: {
|
|
582
|
+
assetAddress: string;
|
|
583
|
+
subId: string | number | bigint;
|
|
584
|
+
limitPrice: string;
|
|
585
|
+
amount: string;
|
|
586
|
+
maxFee: string;
|
|
587
|
+
recipientSubaccountId: number | bigint;
|
|
588
|
+
isBid: boolean;
|
|
589
|
+
}): Hex;
|
|
590
|
+
declare function encodeDeriveTransferData(args: {
|
|
591
|
+
toSubaccountId: number | bigint;
|
|
592
|
+
newSubaccountManager: number | bigint;
|
|
593
|
+
asset: string;
|
|
594
|
+
subId: number | bigint;
|
|
595
|
+
amount: string;
|
|
596
|
+
maxFeeUsd: string;
|
|
597
|
+
}): Hex;
|
|
598
|
+
declare function deriveActionTypehash(): Hex;
|
|
599
|
+
declare function buildDeriveActionTypedData(args: {
|
|
600
|
+
network: DeriveNetwork;
|
|
601
|
+
subaccountId: number | bigint;
|
|
602
|
+
nonce: string;
|
|
603
|
+
module: string;
|
|
604
|
+
data: Hex;
|
|
605
|
+
expirySec: number;
|
|
606
|
+
owner: string;
|
|
607
|
+
signer: string;
|
|
608
|
+
}): Eip712TypedDataPayload;
|
|
609
|
+
declare function hashDeriveAction(args: Parameters<typeof buildDeriveActionTypedData>[0]): Hex;
|
|
610
|
+
declare function assertPositiveSubaccountId(subaccountId: number | bigint | undefined): bigint;
|
|
611
|
+
|
|
612
|
+
/** Millisecond UTC timestamp string Derive expects for EIP-191 login. */
|
|
613
|
+
declare function deriveLoginTimestamp(nowMs?: number): string;
|
|
614
|
+
/** Message text for `personal_sign` — the timestamp itself. */
|
|
615
|
+
declare function deriveLoginMessage(timestampMs: string): string;
|
|
616
|
+
declare function deriveLoginDigest(timestampMs: string): `0x${string}`;
|
|
617
|
+
declare function deriveAuthHeaders(auth: DeriveAuth): Record<string, string>;
|
|
618
|
+
|
|
619
|
+
type DeriveOrderDirection = 'buy' | 'sell';
|
|
620
|
+
type DeriveOrderType = 'limit' | 'market';
|
|
621
|
+
type DeriveTimeInForce = 'gtc' | 'ioc' | 'fok' | 'post_only';
|
|
622
|
+
type DeriveTriggerType = 'stoploss' | 'takeprofit';
|
|
623
|
+
type DeriveTriggerPriceType = 'mark' | 'index';
|
|
624
|
+
type DeriveTicketKind = 'limit' | 'stop_limit' | 'twap';
|
|
625
|
+
type DeriveExchangeCommon = {
|
|
626
|
+
keyGen: KeyGenSubsetForPermit;
|
|
627
|
+
chainId: number;
|
|
628
|
+
purposeText: string;
|
|
629
|
+
executorAddress: string;
|
|
630
|
+
subaccountId: number;
|
|
631
|
+
expiryDate?: number;
|
|
632
|
+
nonce?: string;
|
|
633
|
+
signatureExpirySec?: number;
|
|
634
|
+
};
|
|
635
|
+
type DerivePlaceOrderMultisignArgs = DeriveExchangeCommon & {
|
|
636
|
+
instrumentName: string;
|
|
637
|
+
direction: DeriveOrderDirection;
|
|
638
|
+
amount: string;
|
|
639
|
+
limitPrice: string;
|
|
640
|
+
maxFee: string;
|
|
641
|
+
orderType?: DeriveOrderType;
|
|
642
|
+
timeInForce?: DeriveTimeInForce;
|
|
643
|
+
reduceOnly?: boolean;
|
|
644
|
+
label?: string;
|
|
645
|
+
ticketKind?: DeriveTicketKind;
|
|
646
|
+
triggerPrice?: string;
|
|
647
|
+
triggerType?: DeriveTriggerType;
|
|
648
|
+
triggerPriceType?: DeriveTriggerPriceType;
|
|
649
|
+
algoDurationSec?: number;
|
|
650
|
+
algoNumSlices?: number;
|
|
651
|
+
};
|
|
652
|
+
type DeriveReplaceOrderMultisignArgs = DerivePlaceOrderMultisignArgs & {
|
|
653
|
+
orderIdToCancel?: string;
|
|
654
|
+
nonceToCancel?: string;
|
|
655
|
+
};
|
|
656
|
+
type DeriveCancelMultisignArgs = {
|
|
657
|
+
keyGen: KeyGenSubsetForPermit;
|
|
658
|
+
chainId: number;
|
|
659
|
+
purposeText: string;
|
|
660
|
+
executorAddress: string;
|
|
661
|
+
subaccountId: number;
|
|
662
|
+
instrumentName: string;
|
|
663
|
+
orderId: string;
|
|
664
|
+
expiryDate?: number;
|
|
665
|
+
};
|
|
666
|
+
declare function buildDerivePlaceOrderMultisign(args: DerivePlaceOrderMultisignArgs): Promise<MultisignBuildResult>;
|
|
667
|
+
declare function buildDeriveReplaceOrderMultisign(args: DeriveReplaceOrderMultisignArgs): Promise<MultisignBuildResult>;
|
|
668
|
+
/**
|
|
669
|
+
* v3 `private/cancel` is session-auth only (no Action module). Sign EIP-191 login
|
|
670
|
+
* so the node can POST with X-Derive* headers plus instrument/order/subaccount.
|
|
671
|
+
*/
|
|
672
|
+
declare function buildDeriveCancelMultisign(args: DeriveCancelMultisignArgs): MultisignBuildResult;
|
|
673
|
+
|
|
674
|
+
type ChainRow$3 = {
|
|
675
|
+
legacy?: boolean;
|
|
676
|
+
gasLimit?: number;
|
|
677
|
+
gasMultiplier?: number;
|
|
678
|
+
gasPrice?: number;
|
|
679
|
+
baseFee?: number;
|
|
680
|
+
priorityFee?: number;
|
|
681
|
+
baseFeeMultiplier?: number;
|
|
682
|
+
};
|
|
683
|
+
type DeriveDepositNewSubaccountArgs = {
|
|
684
|
+
keyGen: KeyGenSubsetForPermit;
|
|
685
|
+
chainId: number;
|
|
686
|
+
rpcUrl: string;
|
|
687
|
+
chainDetail: ChainRow$3;
|
|
688
|
+
useCustomGas: boolean;
|
|
689
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
690
|
+
executorAddress: Address | string;
|
|
691
|
+
purposeText: string;
|
|
692
|
+
/** Protocol-asset address from risk-universe collaterals[].address (not the row-chain token). */
|
|
693
|
+
protocolAsset: string;
|
|
694
|
+
/** Underlying ERC-20 to approve (`collaterals[].erc20.underlying_erc20`) on Ethereum L1. */
|
|
695
|
+
underlyingErc20: string;
|
|
696
|
+
amountHuman: string;
|
|
697
|
+
managerId: number;
|
|
698
|
+
actionManager?: string;
|
|
699
|
+
expiryDate?: number;
|
|
700
|
+
};
|
|
701
|
+
declare function buildDeriveDepositNewSubaccountMultisign(args: DeriveDepositNewSubaccountArgs): Promise<MultisignBuildResult>;
|
|
702
|
+
|
|
703
|
+
type ChainRow$2 = {
|
|
704
|
+
legacy?: boolean;
|
|
705
|
+
gasLimit?: number;
|
|
706
|
+
gasMultiplier?: number;
|
|
707
|
+
gasPrice?: number;
|
|
708
|
+
baseFee?: number;
|
|
709
|
+
priorityFee?: number;
|
|
710
|
+
baseFeeMultiplier?: number;
|
|
711
|
+
};
|
|
712
|
+
declare function deriveRegisterDepositAddress(args: {
|
|
713
|
+
wallet: string;
|
|
714
|
+
managerId?: number;
|
|
715
|
+
subaccountId?: number;
|
|
716
|
+
chainId?: number;
|
|
717
|
+
network?: DeriveNetwork;
|
|
718
|
+
}): Promise<{
|
|
719
|
+
depositAddress: string;
|
|
720
|
+
wallet: string;
|
|
721
|
+
managerId: number | null;
|
|
722
|
+
subaccountId: number | null;
|
|
723
|
+
network: DeriveNetwork;
|
|
724
|
+
notes: string;
|
|
725
|
+
}>;
|
|
726
|
+
declare function buildDeriveDepositAddressTransferMultisign(args: {
|
|
727
|
+
keyGen: KeyGenSubsetForPermit;
|
|
728
|
+
chainId: number;
|
|
729
|
+
rpcUrl: string;
|
|
730
|
+
chainDetail: ChainRow$2;
|
|
731
|
+
useCustomGas: boolean;
|
|
732
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
733
|
+
executorAddress: Address | string;
|
|
734
|
+
purposeText: string;
|
|
735
|
+
underlyingErc20: string;
|
|
736
|
+
amountHuman: string;
|
|
737
|
+
depositAddress: string;
|
|
738
|
+
expiryDate?: number;
|
|
739
|
+
}): Promise<MultisignBuildResult>;
|
|
740
|
+
|
|
741
|
+
/** Socket SuperBridge destination — Derive Chain. Users never switch Continuum Assets to this id. */
|
|
742
|
+
declare const DERIVE_SOCKET_APP_CHAIN_ID = 957;
|
|
743
|
+
declare const DERIVE_SOCKET_CHAIN_IDS: readonly [1, 10, 8453, 42161];
|
|
744
|
+
declare const DERIVE_HYPE_CHAIN_ID = 999;
|
|
745
|
+
declare const DERIVE_WHYPE: "0x5555555555555555555555555555555555555555";
|
|
746
|
+
/** HyperEVM vault that escrows wHYPE for Derive margin. Override with DERIVE_HYPE_VAULT. */
|
|
747
|
+
declare const DERIVE_HYPE_VAULT_DEFAULT: "0xb792F94Ed56eD0bA163e5Ba139e2Bd0029A81d0a";
|
|
748
|
+
declare const DERIVE_SOCKET_MSG_GAS_LIMIT = 500000n;
|
|
749
|
+
declare const DERIVE_SOCKET_FEE_FALLBACK_WEI = 2000000000000000n;
|
|
750
|
+
type DeriveSocketRoute = {
|
|
751
|
+
chainId: number;
|
|
752
|
+
symbol: string;
|
|
753
|
+
token: `0x${string}`;
|
|
754
|
+
vault: `0x${string}`;
|
|
755
|
+
connector: `0x${string}`;
|
|
756
|
+
decimals: number;
|
|
757
|
+
};
|
|
758
|
+
declare function isDeriveSocketChainId(chainId: number): boolean;
|
|
759
|
+
declare function deriveHypeVaultAddress(override?: string): `0x${string}`;
|
|
760
|
+
declare function deriveSocketRouteForToken(chainId: number, token: string): DeriveSocketRoute | null;
|
|
761
|
+
declare function deriveSocketWethRoute(chainId: number): DeriveSocketRoute | null;
|
|
762
|
+
type DeriveFundKind = 'l1_direct' | 'socket' | 'hype_vault';
|
|
763
|
+
type DeriveFundRoute = {
|
|
764
|
+
kind: DeriveFundKind;
|
|
765
|
+
chainId: number;
|
|
766
|
+
symbol: string;
|
|
767
|
+
token: `0x${string}`;
|
|
768
|
+
decimals: number;
|
|
769
|
+
native: boolean;
|
|
770
|
+
socket?: DeriveSocketRoute;
|
|
771
|
+
};
|
|
772
|
+
/** Resolve a Continuum asset row to a deposit path. Native gas maps to WETH (Socket) or HYPE (HyperEVM). */
|
|
773
|
+
declare function deriveFundRouteForAssetRow(args: {
|
|
774
|
+
chainId: number;
|
|
775
|
+
contractAddress: string;
|
|
776
|
+
}): DeriveFundRoute | null;
|
|
777
|
+
declare function deriveFundableTokensForChain(chainId: number): Array<{
|
|
778
|
+
address: `0x${string}`;
|
|
779
|
+
symbol: string;
|
|
780
|
+
decimals: number;
|
|
781
|
+
roles: string[];
|
|
782
|
+
}>;
|
|
783
|
+
|
|
784
|
+
type ChainRow$1 = {
|
|
785
|
+
legacy?: boolean;
|
|
786
|
+
gasLimit?: number;
|
|
787
|
+
gasMultiplier?: number;
|
|
788
|
+
gasPrice?: number;
|
|
789
|
+
baseFee?: number;
|
|
790
|
+
priorityFee?: number;
|
|
791
|
+
baseFeeMultiplier?: number;
|
|
792
|
+
};
|
|
793
|
+
type DeriveSocketDepositArgs = {
|
|
794
|
+
keyGen: KeyGenSubsetForPermit;
|
|
795
|
+
chainId: number;
|
|
796
|
+
rpcUrl: string;
|
|
797
|
+
chainDetail: ChainRow$1;
|
|
798
|
+
useCustomGas: boolean;
|
|
799
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
800
|
+
executorAddress: Address | string;
|
|
801
|
+
purposeText: string;
|
|
802
|
+
/** Row token; native 0x0 wraps to WETH then bridges. */
|
|
803
|
+
token: string;
|
|
804
|
+
amountHuman: string;
|
|
805
|
+
/** Receiver on Derive Chain — same KeyGen EOA. Defaults to executor. */
|
|
806
|
+
receiver?: string;
|
|
807
|
+
expiryDate?: number;
|
|
808
|
+
};
|
|
809
|
+
declare function buildDeriveSocketDepositMultisign(args: DeriveSocketDepositArgs): Promise<MultisignBuildResult>;
|
|
810
|
+
|
|
811
|
+
type ChainRow = {
|
|
812
|
+
legacy?: boolean;
|
|
813
|
+
gasLimit?: number;
|
|
814
|
+
gasMultiplier?: number;
|
|
815
|
+
gasPrice?: number;
|
|
816
|
+
baseFee?: number;
|
|
817
|
+
priorityFee?: number;
|
|
818
|
+
baseFeeMultiplier?: number;
|
|
819
|
+
};
|
|
820
|
+
type DeriveHypeVaultDepositArgs = {
|
|
821
|
+
keyGen: KeyGenSubsetForPermit;
|
|
822
|
+
chainId: number;
|
|
823
|
+
rpcUrl: string;
|
|
824
|
+
chainDetail: ChainRow;
|
|
825
|
+
useCustomGas: boolean;
|
|
826
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
827
|
+
executorAddress: Address | string;
|
|
828
|
+
purposeText: string;
|
|
829
|
+
amountHuman: string;
|
|
830
|
+
/** Native 0x0 wraps first; WHYPE skips wrap. */
|
|
831
|
+
token?: string;
|
|
832
|
+
vault?: string;
|
|
833
|
+
expiryDate?: number;
|
|
834
|
+
};
|
|
835
|
+
declare function buildDeriveHypeVaultDepositMultisign(args: DeriveHypeVaultDepositArgs): Promise<MultisignBuildResult>;
|
|
836
|
+
|
|
837
|
+
type DeriveTransferSpotMultisignArgs = {
|
|
838
|
+
keyGen: KeyGenSubsetForPermit;
|
|
839
|
+
chainId: number;
|
|
840
|
+
purposeText: string;
|
|
841
|
+
executorAddress: string;
|
|
842
|
+
/** Funded source subaccount (must already exist). */
|
|
843
|
+
fromSubaccountId: number;
|
|
844
|
+
/** 0 when creating an extra subaccount via newSubaccountManager. */
|
|
845
|
+
toSubaccountId: number;
|
|
846
|
+
newSubaccountManager: number;
|
|
847
|
+
asset: string;
|
|
848
|
+
amount: string;
|
|
849
|
+
maxFeeUsd?: string;
|
|
850
|
+
subId?: number;
|
|
851
|
+
expiryDate?: number;
|
|
852
|
+
nonce?: string;
|
|
853
|
+
signatureExpirySec?: number;
|
|
854
|
+
};
|
|
855
|
+
declare function buildDeriveTransferSpotMultisign(args: DeriveTransferSpotMultisignArgs): Promise<MultisignBuildResult>;
|
|
856
|
+
|
|
857
|
+
declare const deriveProtocolModule: ProtocolModule;
|
|
858
|
+
|
|
859
|
+
export { DERIVE_ACTION_MANAGER_TESTNET, DERIVE_ACTION_TYPEHASH, DERIVE_ACTION_TYPES, DERIVE_ASSET_ROW_CHAIN_IDS, DERIVE_DEFAULT_LOOKBACK_DAYS, DERIVE_DEFAULT_OHLCV_BARS, DERIVE_DEFAULT_OHLCV_INTERVAL, DERIVE_DEFAULT_SIGNATURE_EXPIRY_SEC, DERIVE_DEFAULT_TICKER_ATM_STRIKES, DERIVE_DOMAIN_SEPARATOR_MAINNET, DERIVE_DOMAIN_SEPARATOR_TESTNET, DERIVE_EIP712_NAME, DERIVE_EIP712_VERSION, DERIVE_HYPE_CHAIN_ID, DERIVE_HYPE_VAULT_DEFAULT, DERIVE_MAINNET_API, DERIVE_MAINNET_API_V2, DERIVE_MATCHING_VERIFYING_CONTRACT, DERIVE_MAX_LOOKBACK_DAYS, DERIVE_MAX_OHLCV_BARS, DERIVE_MIN_ORDER_EXPIRY_SEC, DERIVE_MISSING_SUBACCOUNT_ERROR, DERIVE_OHLCV_INTERVALS, DERIVE_OHLCV_PERIOD_SEC, DERIVE_PROTOCOL_ID, DERIVE_SETTLEMENT_CHAIN_IDS, DERIVE_SOCKET_APP_CHAIN_ID, DERIVE_SOCKET_CHAIN_IDS, DERIVE_SOCKET_FEE_FALLBACK_WEI, DERIVE_SOCKET_MSG_GAS_LIMIT, DERIVE_TESTNET_API, DERIVE_TESTNET_API_V2, DERIVE_TRADE_MODULE, DERIVE_TRANSFER_MODULE, DERIVE_UNFUNDED_NEXT, DERIVE_UNFUNDED_NOTES, DERIVE_WHYPE, type DeriveAuth, type DeriveCancelMultisignArgs, type DeriveCurrency, type DeriveCurrencyManager, type DeriveDepositNewSubaccountArgs, type DeriveFundKind, type DeriveFundRoute, type DeriveHypeVaultDepositArgs, type DeriveInstrument, type DeriveMappedOptionInstrument, type DeriveNetwork, type DeriveOhlcvCandle, type DeriveOhlcvInterval, type DeriveOptionExpirySummary, type DeriveOptionType, type DeriveOrderBookLevel, type DeriveOrderDirection, type DeriveOrderType, type DeriveParsedInstrumentName, type DerivePlaceOrderMultisignArgs, type DeriveReplaceOrderMultisignArgs, type DeriveRpcError, type DeriveSocketDepositArgs, type DeriveSocketRoute, type DeriveTickerQuote, type DeriveTicketKind, type DeriveTimeInForce, type DeriveTransferSpotMultisignArgs, type DeriveTriggerPriceType, type DeriveTriggerType, NATIVE_ZERO, assertPositiveSubaccountId, buildDeriveActionTypedData, buildDeriveCancelMultisign, buildDeriveDepositAddressTransferMultisign, buildDeriveDepositNewSubaccountMultisign, buildDeriveHypeVaultDepositMultisign, buildDerivePlaceOrderMultisign, buildDeriveReplaceOrderMultisign, buildDeriveSocketDepositMultisign, buildDeriveTransferSpotMultisign, collectDeriveTickerRows, deriveActionManagerAddress, deriveActionTypehash, deriveAdvisorNotes, deriveApiBaseUrl, deriveApiBaseUrlForChainId, deriveApiFallbackBaseUrl, deriveAtmTickerWindow, deriveAuthHeaders, deriveDomainSeparator, deriveE18, deriveEmptySubaccountsPayload, deriveExpirySec, deriveExpiryUnixToYmd, deriveFetchCurrenciesRaw, deriveFetchCurrenciesSummary, deriveFetchInstrument, deriveFetchMarketSnapshotSummary, deriveFetchOhlcvSummary, deriveFetchOpenOrdersSummary, deriveFetchOptionChainAgentSummary, deriveFetchOptionChainSummary, deriveFetchOptionInstruments, deriveFetchOrderBookSummary, deriveFetchPendingDepositsSummary, deriveFetchPortfolioSummary, deriveFetchPositionsSummary, deriveFetchRiskUniversesSummary, deriveFetchSubaccountsSummary, deriveFetchTickersSummary, deriveFundRouteForAssetRow, deriveFundableTokensForChain, deriveHypeVaultAddress, deriveKeyForNodeAssetRow, deriveLoginDigest, deriveLoginMessage, deriveLoginTimestamp, deriveMappedTokensForChain, deriveMatchingDomain, deriveNativeWrappedForChain, deriveNetworkFromChainId, deriveOrderQuoteSummary, deriveParseInstrumentName, deriveProtocolModule, deriveRandomNonce, deriveRegisterDepositAddress, deriveRpc, deriveSearchInstruments, deriveSearchInstrumentsSummary, deriveSettlementChainId, deriveSocketRouteForToken, deriveSocketWethRoute, encodeDeriveTradeData, encodeDeriveTransferData, hashDeriveAction, isDeriveAssetRowChainId, isDeriveChainSupported, isDerivePublicMethod, isDeriveRecoverablePublicError, isDeriveSettlementChainId, isDeriveSocketChainId, isEmptyDerivePublicResult, mapDeriveOrderBookLevels, mapDeriveTickerRow, mapDeriveTradingviewCandles, normalizeDeriveExpiryYmd, requireDeriveAuth, resolveDeriveOhlcvWindow, summarizeDeriveOptionChain, synthesizeDeriveRiskUniversesFromCurrencies };
|