@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.
Files changed (63) hide show
  1. package/dist/agent/catalog.cjs +1083 -4
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1191 -7
  4. package/dist/agent/catalog.js +1047 -5
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/derive/SKILL.md +112 -0
  7. package/dist/agent/skills/hyperliquid/SKILL.md +22 -2
  8. package/dist/chains/evm/index.d.ts +118 -6
  9. package/dist/chains/near/index.d.ts +7 -1
  10. package/dist/chains/solana/index.d.ts +7 -1
  11. package/dist/core/index.cjs +2 -1
  12. package/dist/core/index.cjs.map +1 -1
  13. package/dist/core/index.d.ts +138 -7
  14. package/dist/core/index.js +2 -1
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/index.cjs +2 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +848 -16
  19. package/dist/index.js +2 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/protocols/evm/aave-v4/index.d.ts +600 -6
  22. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
  23. package/dist/protocols/evm/aerodrome/index.d.ts +125 -5
  24. package/dist/protocols/evm/aerodrome/index.js.map +1 -1
  25. package/dist/protocols/evm/arcus/index.d.ts +66 -2
  26. package/dist/protocols/evm/circle-cctp/index.d.ts +71 -2
  27. package/dist/protocols/evm/compound-v3/index.d.ts +52 -1
  28. package/dist/protocols/evm/continuum-dao/index.d.ts +56 -1
  29. package/dist/protocols/evm/curve-dao/index.d.ts +66 -2
  30. package/dist/protocols/evm/derive/index.cjs +2655 -0
  31. package/dist/protocols/evm/derive/index.cjs.map +1 -0
  32. package/dist/protocols/evm/derive/index.d.ts +859 -0
  33. package/dist/protocols/evm/derive/index.js +2536 -0
  34. package/dist/protocols/evm/derive/index.js.map +1 -0
  35. package/dist/protocols/evm/ethena/index.d.ts +52 -1
  36. package/dist/protocols/evm/euler-v2/index.d.ts +115 -16
  37. package/dist/protocols/evm/gmx/index.d.ts +66 -2
  38. package/dist/protocols/evm/hyperliquid/index.cjs +545 -267
  39. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  40. package/dist/protocols/evm/hyperliquid/index.d.ts +152 -7
  41. package/dist/protocols/evm/hyperliquid/index.js +535 -269
  42. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  43. package/dist/protocols/evm/lido/index.d.ts +52 -1
  44. package/dist/protocols/evm/maple/index.d.ts +52 -1
  45. package/dist/protocols/evm/morpho/index.d.ts +115 -4
  46. package/dist/protocols/evm/pendle/index.cjs +2 -1
  47. package/dist/protocols/evm/pendle/index.cjs.map +1 -1
  48. package/dist/protocols/evm/pendle/index.d.ts +125 -5
  49. package/dist/protocols/evm/pendle/index.js +2 -1
  50. package/dist/protocols/evm/pendle/index.js.map +1 -1
  51. package/dist/protocols/evm/permit2/index.d.ts +14 -1
  52. package/dist/protocols/evm/sky/index.d.ts +52 -1
  53. package/dist/protocols/evm/uniswap-v4/index.d.ts +78 -4
  54. package/dist/protocols/evm/venice/index.d.ts +52 -1
  55. package/package.json +7 -2
  56. package/dist/buildBatch-tsEUVn_a.d.ts +0 -45
  57. package/dist/eip712Multisign-6oNIlObj.d.ts +0 -39
  58. package/dist/envelope-Cm-llShH.d.ts +0 -37
  59. package/dist/merklDistributor-CdqtZC9N.d.ts +0 -65
  60. package/dist/multisign-Dr0j9fHm.d.ts +0 -489
  61. package/dist/registry-BvsXh0-r.d.ts +0 -8
  62. package/dist/types-RJpoU4Pc.d.ts +0 -34
  63. package/dist/types-lIfv59N1.d.ts +0 -63
@@ -1,8 +1,66 @@
1
- import { b as KeyGenSubsetForPermit, M as MultisignBuildResult, e as ProtocolModule } from '../../../types-lIfv59N1.js';
2
- import { Address } from 'viem';
3
- import { E as EvmChainDetail } from '../../../types-RJpoU4Pc.js';
4
- import { b as buildEvmMultisignBatch } from '../../../buildBatch-tsEUVn_a.js';
5
- import '../../../envelope-Cm-llShH.js';
1
+ import { Address, PublicClient } 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
+ interface MultisignCommonArgs {
50
+ keyGen: KeyGenSubset;
51
+ purposeText: string;
52
+ /** Optional Unix seconds (UTC) for POST /multiSignRequest expiryDate. */
53
+ expiryDate?: number;
54
+ }
55
+ type KeyGenSubset = {
56
+ pubkeyhex?: string;
57
+ keylist?: string[];
58
+ ClientKeys?: Record<string, string>;
59
+ groupId?: string;
60
+ GroupId?: string;
61
+ };
62
+ /** App-compatible alias used by multisign builders and Permit2 helpers. */
63
+ type KeyGenSubsetForPermit = KeyGenSubset;
6
64
 
7
65
  declare const PENDLE_PROTOCOL_ID = "pendle";
8
66
  declare const PENDLE_CORE_API_BASE = "https://api-v2.pendle.finance/core";
@@ -276,6 +334,68 @@ declare function buildPendlePurposePrefill(args: {
276
334
  slippagePercent?: number;
277
335
  }): string;
278
336
 
337
+ type EvmChainDetail = {
338
+ legacy?: boolean;
339
+ gasLimit?: number;
340
+ gasMultiplier?: number;
341
+ gasPrice?: number;
342
+ baseFee?: number;
343
+ priorityFee?: number;
344
+ baseFeeMultiplier?: number;
345
+ };
346
+ interface EvmProtocolContext extends MultisignCommonArgs {
347
+ chainCategory: 'evm';
348
+ chainId: number;
349
+ rpcUrl: string;
350
+ executorAddress: Address;
351
+ chainDetail: EvmChainDetail;
352
+ useCustomGas: boolean;
353
+ customGasChainDetails?: Record<string, unknown> | null;
354
+ }
355
+ type EvmTxStep = {
356
+ to: Address;
357
+ data: `0x${string}`;
358
+ value: bigint;
359
+ /** Fallback when estimateGas reverts */
360
+ fallbackGas?: bigint;
361
+ /** When set, use routerSwapGasLimitFromEstimate instead of plain estimate */
362
+ routerSwap?: boolean;
363
+ };
364
+
365
+ type EvmBatchMetaBuilder = (args: {
366
+ step: EvmTxStep;
367
+ index: number;
368
+ gasLimit: bigint;
369
+ }) => Record<string, unknown>;
370
+ type EvmBuildBatchArgs = {
371
+ context: EvmProtocolContext;
372
+ steps: EvmTxStep[];
373
+ purposeSuffix?: string;
374
+ buildBatchMeta: EvmBatchMetaBuilder;
375
+ /** First leg msgRaw without 0x prefix; defaults to first step calldata */
376
+ firstMsgRawNo0x?: string;
377
+ destinationAddress?: Address;
378
+ /** Top-level `value` on bodyForSign when the payable amount is not on the first leg */
379
+ payableValueWei?: bigint;
380
+ resolveGasLimit?: (args: {
381
+ step: EvmTxStep;
382
+ index: number;
383
+ estimatedGas: bigint;
384
+ publicClient: PublicClient;
385
+ }) => Promise<bigint> | bigint;
386
+ /** Override default `estimateGas` (e.g. trade-API gas, skip post-approve deposit estimate). */
387
+ estimateGasForStep?: (args: {
388
+ step: EvmTxStep;
389
+ index: number;
390
+ publicClient: PublicClient;
391
+ executor: Address;
392
+ }) => Promise<bigint> | bigint;
393
+ };
394
+ /**
395
+ * Build unsigned EVM txs, estimate gas, serialize, hash — then assemble mpc-auth body via core envelope.
396
+ */
397
+ declare function buildEvmMultisignBatch(args: EvmBuildBatchArgs): Promise<MultisignBuildResult>;
398
+
279
399
  declare function isPendleConvertEvmSignRequest(extra: Record<string, unknown> | null | undefined): boolean;
280
400
  declare function buildEvmMultisignBodyPendleFromConvert(args: {
281
401
  keyGen: KeyGenSubsetForPermit;
@@ -994,7 +994,8 @@ var DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
994
994
  "arcus",
995
995
  "curve-dao",
996
996
  "aerodrome",
997
- "pendle"
997
+ "pendle",
998
+ "derive"
998
999
  ]);
999
1000
  function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
1000
1001
  if (typeof explicitExpiryDate === "number" && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {