@continuumdao/ctm-mpc-defi 0.2.29 → 0.2.30

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 (40) hide show
  1. package/dist/agent/catalog.cjs +1249 -1
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1468 -1
  4. package/dist/agent/catalog.js +1180 -3
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/continuum-dao/SKILL.md +139 -0
  7. package/dist/core/index.cjs +42 -39
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.js +42 -39
  11. package/dist/core/index.js.map +1 -1
  12. package/dist/{eip712Multisign-xhXpUYp3.d.ts → eip712Multisign-DCW7heqX.d.ts} +11 -8
  13. package/dist/index.cjs +64 -57
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +64 -57
  17. package/dist/index.js.map +1 -1
  18. package/dist/protocols/evm/arcus/index.cjs +62 -55
  19. package/dist/protocols/evm/arcus/index.cjs.map +1 -1
  20. package/dist/protocols/evm/arcus/index.js +62 -55
  21. package/dist/protocols/evm/arcus/index.js.map +1 -1
  22. package/dist/protocols/evm/continuum-dao/index.cjs +2237 -0
  23. package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -0
  24. package/dist/protocols/evm/continuum-dao/index.d.ts +700 -0
  25. package/dist/protocols/evm/continuum-dao/index.js +2110 -0
  26. package/dist/protocols/evm/continuum-dao/index.js.map +1 -0
  27. package/dist/protocols/evm/hyperliquid/index.cjs +125 -110
  28. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  29. package/dist/protocols/evm/hyperliquid/index.js +125 -110
  30. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  31. package/dist/protocols/evm/permit2/index.cjs +66 -59
  32. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  33. package/dist/protocols/evm/permit2/index.js +66 -59
  34. package/dist/protocols/evm/permit2/index.js.map +1 -1
  35. package/dist/protocols/evm/uniswap-v4/index.cjs +63 -56
  36. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  37. package/dist/protocols/evm/uniswap-v4/index.d.ts +1 -1
  38. package/dist/protocols/evm/uniswap-v4/index.js +63 -56
  39. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  40. package/package.json +6 -1
@@ -15,22 +15,25 @@ type Eip712TypedDataPayload = {
15
15
  type Eip712MultisignDelivery = Record<string, unknown> & {
16
16
  kind: string;
17
17
  };
18
- type BuildEip712MultisignBodyArgs = {
18
+ type BuildEip712MultisignLeg = {
19
+ typedData: Eip712TypedDataPayload;
20
+ delivery: Eip712MultisignDelivery;
21
+ audit?: Record<string, unknown>;
22
+ };
23
+ type BuildEip712MultisignArgs = {
19
24
  keyGen: KeyGenSubset;
20
25
  purposeText: string;
21
26
  purposeSuffix?: string;
22
27
  /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */
23
28
  destinationChainID: string;
24
29
  destinationAddress: string;
25
- typedData: Eip712TypedDataPayload;
26
- delivery: Eip712MultisignDelivery;
27
- audit?: Record<string, unknown>;
30
+ legs: readonly BuildEip712MultisignLeg[];
28
31
  expiryDate?: number;
29
32
  };
30
33
  /**
31
- * Build an mpc-auth multiSignRequest body for a single-leg EIP-712 digest (no EVM tx broadcast).
32
- * `msgHash` is the EIP-712 hash; `msgRaw` is UTF-8 hex JSON audit envelope (not RLP calldata).
34
+ * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).
35
+ * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.
33
36
  */
34
- declare function buildEip712MultisignBody(args: BuildEip712MultisignBodyArgs): MultisignBuildResult;
37
+ declare function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult;
35
38
 
36
- export { type BuildEip712MultisignBodyArgs as B, EIP712_SIGN_REQUEST_KIND as E, type Eip712MultisignDelivery as a, type Eip712TypedDataField as b, type Eip712TypedDataPayload as c, buildEip712MultisignBody as d };
39
+ export { type BuildEip712MultisignArgs as B, EIP712_SIGN_REQUEST_KIND as E, type BuildEip712MultisignLeg as a, type Eip712MultisignDelivery as b, type Eip712TypedDataField as c, type Eip712TypedDataPayload as d, buildEip712Multisign as e };
package/dist/index.cjs CHANGED
@@ -182,57 +182,60 @@ function eip712SignatureText(domain, primaryType) {
182
182
  function jsonStringifyForAudit(value) {
183
183
  return JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v);
184
184
  }
185
- function eip712MsgRawHex(typedData, delivery) {
186
- const envelope = {
185
+ function eip712LegEnvelope(typedData, delivery, digest) {
186
+ return {
187
187
  version: 1,
188
- ...typedData,
189
- delivery
190
- };
191
- return viem.stringToHex(jsonStringifyForAudit(envelope));
192
- }
193
- function buildEip712MultisignBody(args) {
194
- const { typedData, delivery } = args;
195
- const digest = viem.hashTypedData({
188
+ digest,
196
189
  domain: typedData.domain,
197
190
  types: typedData.types,
198
191
  primaryType: typedData.primaryType,
199
- message: typedData.message
200
- });
201
- const extraJSON = {
202
- signRequestKind: EIP712_SIGN_REQUEST_KIND,
203
- eip712: {
204
- version: 1,
205
- digest,
206
- domain: typedData.domain,
207
- types: typedData.types,
208
- primaryType: typedData.primaryType,
209
- message: typedData.message
210
- },
192
+ message: typedData.message,
211
193
  delivery
212
194
  };
195
+ }
196
+ function eip712MsgRawHex(envelope) {
197
+ return viem.stringToHex(jsonStringifyForAudit(envelope));
198
+ }
199
+ function buildEip712Multisign(args) {
200
+ if (args.legs.length < 1) {
201
+ throw new Error("buildEip712Multisign requires at least one leg");
202
+ }
203
+ const eip712 = [];
204
+ const legs = args.legs.map((leg) => {
205
+ const digest = viem.hashTypedData({
206
+ domain: leg.typedData.domain,
207
+ types: leg.typedData.types,
208
+ primaryType: leg.typedData.primaryType,
209
+ message: leg.typedData.message
210
+ });
211
+ const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest);
212
+ eip712.push(envelope);
213
+ return {
214
+ msgHash: msgHashNo0x(digest),
215
+ msgRaw: eip712MsgRawHex(envelope),
216
+ destinationAddress: args.destinationAddress,
217
+ signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),
218
+ audit: {
219
+ kind: "EIP712",
220
+ primaryType: leg.typedData.primaryType,
221
+ deliveryKind: leg.delivery.kind,
222
+ ...leg.audit ?? {}
223
+ },
224
+ feeSnapshot: {}
225
+ };
226
+ });
213
227
  return finalizeMultisign({
214
228
  keyGen: args.keyGen,
215
229
  purposeText: args.purposeText,
216
230
  purposeSuffix: args.purposeSuffix,
217
231
  destinationChainID: args.destinationChainID,
218
232
  destinationAddress: args.destinationAddress,
219
- extraJSON,
233
+ extraJSON: {
234
+ signRequestKind: EIP712_SIGN_REQUEST_KIND,
235
+ eip712
236
+ },
220
237
  expiryDate: args.expiryDate,
221
- legs: [
222
- {
223
- msgHash: msgHashNo0x(digest),
224
- msgRaw: eip712MsgRawHex(typedData, delivery),
225
- destinationAddress: args.destinationAddress,
226
- signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),
227
- audit: {
228
- kind: "EIP712",
229
- primaryType: typedData.primaryType,
230
- deliveryKind: delivery.kind,
231
- ...args.audit ?? {}
232
- },
233
- feeSnapshot: {}
234
- }
235
- ]
238
+ legs
236
239
  });
237
240
  }
238
241
  var PAYLOAD_SIGN_ED25519_REQUEST_KIND = "payload_sign_ed25519";
@@ -2895,28 +2898,32 @@ async function buildEvmMultisignBodyUniswapV4LimitOrderBatch(args) {
2895
2898
  quoteResponse: args.fullLimitQuote,
2896
2899
  signatureHex: "0x"
2897
2900
  });
2898
- return buildEip712MultisignBody({
2901
+ return buildEip712Multisign({
2899
2902
  keyGen: args.keyGen,
2900
2903
  purposeText: args.purposeText,
2901
2904
  destinationChainID: String(UNISWAP_LIMIT_ORDER_CHAIN_ID),
2902
2905
  destinationAddress: PERMIT2_ADDRESS,
2903
- typedData,
2904
- delivery: {
2905
- kind: "uniswapx_limit_order",
2906
- chainId: UNISWAP_LIMIT_ORDER_CHAIN_ID,
2907
- swapper: viem.getAddress(args.swapper),
2908
- submitBodyTemplate: submitTemplate,
2909
- quoteResponse: args.fullLimitQuote,
2910
- uniswapApiKey: args.uniswapApiKey,
2911
- tradeApiBaseUrl: args.tradeApiBaseUrl ?? "https://trade-api.gateway.uniswap.org/v1"
2912
- },
2913
- audit: {
2914
- protocol: "uniswap-v4",
2915
- action: "limitOrder",
2916
- routing: args.fullLimitQuote.routing ?? "LIMIT_ORDER",
2917
- orderType: "Limit",
2918
- primaryType: typedData.primaryType
2919
- },
2906
+ legs: [
2907
+ {
2908
+ typedData,
2909
+ delivery: {
2910
+ kind: "uniswapx_limit_order",
2911
+ chainId: UNISWAP_LIMIT_ORDER_CHAIN_ID,
2912
+ swapper: viem.getAddress(args.swapper),
2913
+ submitBodyTemplate: submitTemplate,
2914
+ quoteResponse: args.fullLimitQuote,
2915
+ uniswapApiKey: args.uniswapApiKey,
2916
+ tradeApiBaseUrl: args.tradeApiBaseUrl ?? "https://trade-api.gateway.uniswap.org/v1"
2917
+ },
2918
+ audit: {
2919
+ protocol: "uniswap-v4",
2920
+ action: "limitOrder",
2921
+ routing: args.fullLimitQuote.routing ?? "LIMIT_ORDER",
2922
+ orderType: "Limit",
2923
+ primaryType: typedData.primaryType
2924
+ }
2925
+ }
2926
+ ],
2920
2927
  expiryDate: args.expiryDate
2921
2928
  });
2922
2929
  }
@@ -3442,7 +3449,7 @@ exports.PAYLOAD_SIGN_ED25519_REQUEST_KIND = PAYLOAD_SIGN_ED25519_REQUEST_KIND;
3442
3449
  exports.SOLANA_CHAIN_CATEGORY = SOLANA_CHAIN_CATEGORY;
3443
3450
  exports.approveStepsToEvmTxSteps = approveStepsToEvmTxSteps;
3444
3451
  exports.buildConditionalErc20ApproveSteps = buildConditionalErc20ApproveSteps;
3445
- exports.buildEip712MultisignBody = buildEip712MultisignBody;
3452
+ exports.buildEip712Multisign = buildEip712Multisign;
3446
3453
  exports.buildEvmMultisignBatch = buildEvmMultisignBatch;
3447
3454
  exports.buildPayloadSignEd25519MultisignBody = buildPayloadSignEd25519MultisignBody;
3448
3455
  exports.coingeckoPlatformForChainId = coingeckoPlatformForChainId;