@intentlayer/sdk 0.1.1 → 0.1.3

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/index.d.mts CHANGED
@@ -522,6 +522,12 @@ interface CreateSubWalletParams {
522
522
  * This is separate from per-transaction cap in v2Constraints.
523
523
  */
524
524
  policyDailyCap?: bigint;
525
+ /**
526
+ * Policy preset name for Cloud snapshot metadata (optional).
527
+ * Used for UI display, policy identification, and supported_actions inference.
528
+ * Example: "treasuryTransfer", "swapPolicy", "payroll"
529
+ */
530
+ preset?: string;
525
531
  }
526
532
  /**
527
533
  * Parameters for adding an additional policy to an existing wallet.
@@ -2303,6 +2309,7 @@ declare enum IELErrorCode {
2303
2309
  UNAUTHORIZED_RECIPIENT = "UNAUTHORIZED_RECIPIENT",
2304
2310
  UNAUTHORIZED_ASSET = "UNAUTHORIZED_ASSET",
2305
2311
  DEADLINE_EXCEEDED = "DEADLINE_EXCEEDED",
2312
+ INVALID_CONSTRAINT_LEAF = "INVALID_CONSTRAINT_LEAF",
2306
2313
  VENUE_BLOCKED = "VENUE_BLOCKED",
2307
2314
  INVALID_TARGET = "INVALID_TARGET",
2308
2315
  INVALID_FUNCTION = "INVALID_FUNCTION",
package/dist/index.d.ts CHANGED
@@ -522,6 +522,12 @@ interface CreateSubWalletParams {
522
522
  * This is separate from per-transaction cap in v2Constraints.
523
523
  */
524
524
  policyDailyCap?: bigint;
525
+ /**
526
+ * Policy preset name for Cloud snapshot metadata (optional).
527
+ * Used for UI display, policy identification, and supported_actions inference.
528
+ * Example: "treasuryTransfer", "swapPolicy", "payroll"
529
+ */
530
+ preset?: string;
525
531
  }
526
532
  /**
527
533
  * Parameters for adding an additional policy to an existing wallet.
@@ -2303,6 +2309,7 @@ declare enum IELErrorCode {
2303
2309
  UNAUTHORIZED_RECIPIENT = "UNAUTHORIZED_RECIPIENT",
2304
2310
  UNAUTHORIZED_ASSET = "UNAUTHORIZED_ASSET",
2305
2311
  DEADLINE_EXCEEDED = "DEADLINE_EXCEEDED",
2312
+ INVALID_CONSTRAINT_LEAF = "INVALID_CONSTRAINT_LEAF",
2306
2313
  VENUE_BLOCKED = "VENUE_BLOCKED",
2307
2314
  INVALID_TARGET = "INVALID_TARGET",
2308
2315
  INVALID_FUNCTION = "INVALID_FUNCTION",
package/dist/index.js CHANGED
@@ -2722,6 +2722,7 @@ var IELErrorCode = /* @__PURE__ */ ((IELErrorCode2) => {
2722
2722
  IELErrorCode2["UNAUTHORIZED_RECIPIENT"] = "UNAUTHORIZED_RECIPIENT";
2723
2723
  IELErrorCode2["UNAUTHORIZED_ASSET"] = "UNAUTHORIZED_ASSET";
2724
2724
  IELErrorCode2["DEADLINE_EXCEEDED"] = "DEADLINE_EXCEEDED";
2725
+ IELErrorCode2["INVALID_CONSTRAINT_LEAF"] = "INVALID_CONSTRAINT_LEAF";
2725
2726
  IELErrorCode2["VENUE_BLOCKED"] = "VENUE_BLOCKED";
2726
2727
  IELErrorCode2["INVALID_TARGET"] = "INVALID_TARGET";
2727
2728
  IELErrorCode2["INVALID_FUNCTION"] = "INVALID_FUNCTION";
@@ -2750,6 +2751,8 @@ var ERROR_MAPPING = {
2750
2751
  // Bridge blocking
2751
2752
  "IM_BridgeBlocked": "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */,
2752
2753
  "CL_BridgeBlocked": "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */,
2754
+ // Constraint leaf validation
2755
+ "CL_DomainPrefixMismatch": "INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */,
2753
2756
  // Target/Venue validation
2754
2757
  "IM_InvalidTarget": "INVALID_TARGET" /* INVALID_TARGET */,
2755
2758
  "CL_InvalidTarget": "INVALID_TARGET" /* INVALID_TARGET */,
@@ -2796,6 +2799,8 @@ var ERROR_SIGNATURE_MAPPING = {
2796
2799
  // Bridge blocking
2797
2800
  "0xc9217794": { code: "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */, name: "CL_BridgeBlocked" },
2798
2801
  "0x633b6564": { code: "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */, name: "IM_BridgeBlocked" },
2802
+ // Constraint leaf validation
2803
+ "0x6c89c49e": { code: "INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */, name: "CL_DomainPrefixMismatch" },
2799
2804
  // Target/Venue validation
2800
2805
  "0x1d60b745": { code: "INVALID_TARGET" /* INVALID_TARGET */, name: "CL_InvalidTarget" },
2801
2806
  "0xbbc9f733": { code: "INVALID_TARGET" /* INVALID_TARGET */, name: "IM_InvalidTarget" },
@@ -2836,6 +2841,8 @@ var ERROR_MESSAGES = {
2836
2841
  ["UNAUTHORIZED_ASSET" /* UNAUTHORIZED_ASSET */]: "Asset not authorized",
2837
2842
  // Timing
2838
2843
  ["DEADLINE_EXCEEDED" /* DEADLINE_EXCEEDED */]: "Transaction deadline exceeded",
2844
+ // Constraint leaf
2845
+ ["INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */]: "Invalid constraint leaf: domain prefix mismatch (snapshot may have stale or missing leaf data)",
2839
2846
  // Venue
2840
2847
  ["VENUE_BLOCKED" /* VENUE_BLOCKED */]: "Contract not in venue allowlist",
2841
2848
  ["INVALID_TARGET" /* INVALID_TARGET */]: "Target contract not allowed",
@@ -8072,7 +8079,7 @@ async function createSubWallet(params, runtime) {
8072
8079
  const walletAddress = await runtime.predictWalletAddress(params.parentWallet, salt);
8073
8080
  const isDeployed = await runtime.isWalletDeployed(walletAddress);
8074
8081
  if (!isDeployed) {
8075
- await runtime.deployWallet(params.parentWallet, salt);
8082
+ await runtime.deployWallet(params.parentWallet, salt, params.agentName);
8076
8083
  }
8077
8084
  const constraintData = buildAgentConstraints(
8078
8085
  params.constraints,
@@ -8118,7 +8125,19 @@ async function createSubWallet(params, runtime) {
8118
8125
  validFor: 86400
8119
8126
  // 24 hours
8120
8127
  });
8121
- const result = await runtime.bootstrapPolicy(bootstrapIntent);
8128
+ const result = await runtime.bootstrapPolicy(bootstrapIntent, {
8129
+ policyMode: "v3",
8130
+ delegationMode,
8131
+ leafAndProof: {
8132
+ leaf: constraintData.leafAndProof,
8133
+ proof: constraintData.proof ?? []
8134
+ },
8135
+ recipientProofs: constraintData.recipientProofs ? Object.fromEntries(
8136
+ Object.entries(constraintData.recipientProofs).map(([key, leaf]) => [key, { leaf, proof: [] }])
8137
+ ) : void 0,
8138
+ constraints: params.constraints,
8139
+ preset: params.preset
8140
+ });
8122
8141
  if (!result.success) {
8123
8142
  throw new Error(`Failed to create sub-wallet: ${result.error}`);
8124
8143
  }
package/dist/index.mjs CHANGED
@@ -965,6 +965,7 @@ var IELErrorCode = /* @__PURE__ */ ((IELErrorCode2) => {
965
965
  IELErrorCode2["UNAUTHORIZED_RECIPIENT"] = "UNAUTHORIZED_RECIPIENT";
966
966
  IELErrorCode2["UNAUTHORIZED_ASSET"] = "UNAUTHORIZED_ASSET";
967
967
  IELErrorCode2["DEADLINE_EXCEEDED"] = "DEADLINE_EXCEEDED";
968
+ IELErrorCode2["INVALID_CONSTRAINT_LEAF"] = "INVALID_CONSTRAINT_LEAF";
968
969
  IELErrorCode2["VENUE_BLOCKED"] = "VENUE_BLOCKED";
969
970
  IELErrorCode2["INVALID_TARGET"] = "INVALID_TARGET";
970
971
  IELErrorCode2["INVALID_FUNCTION"] = "INVALID_FUNCTION";
@@ -993,6 +994,8 @@ var ERROR_MAPPING = {
993
994
  // Bridge blocking
994
995
  "IM_BridgeBlocked": "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */,
995
996
  "CL_BridgeBlocked": "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */,
997
+ // Constraint leaf validation
998
+ "CL_DomainPrefixMismatch": "INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */,
996
999
  // Target/Venue validation
997
1000
  "IM_InvalidTarget": "INVALID_TARGET" /* INVALID_TARGET */,
998
1001
  "CL_InvalidTarget": "INVALID_TARGET" /* INVALID_TARGET */,
@@ -1039,6 +1042,8 @@ var ERROR_SIGNATURE_MAPPING = {
1039
1042
  // Bridge blocking
1040
1043
  "0xc9217794": { code: "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */, name: "CL_BridgeBlocked" },
1041
1044
  "0x633b6564": { code: "BRIDGE_BLOCKED" /* BRIDGE_BLOCKED */, name: "IM_BridgeBlocked" },
1045
+ // Constraint leaf validation
1046
+ "0x6c89c49e": { code: "INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */, name: "CL_DomainPrefixMismatch" },
1042
1047
  // Target/Venue validation
1043
1048
  "0x1d60b745": { code: "INVALID_TARGET" /* INVALID_TARGET */, name: "CL_InvalidTarget" },
1044
1049
  "0xbbc9f733": { code: "INVALID_TARGET" /* INVALID_TARGET */, name: "IM_InvalidTarget" },
@@ -1079,6 +1084,8 @@ var ERROR_MESSAGES = {
1079
1084
  ["UNAUTHORIZED_ASSET" /* UNAUTHORIZED_ASSET */]: "Asset not authorized",
1080
1085
  // Timing
1081
1086
  ["DEADLINE_EXCEEDED" /* DEADLINE_EXCEEDED */]: "Transaction deadline exceeded",
1087
+ // Constraint leaf
1088
+ ["INVALID_CONSTRAINT_LEAF" /* INVALID_CONSTRAINT_LEAF */]: "Invalid constraint leaf: domain prefix mismatch (snapshot may have stale or missing leaf data)",
1082
1089
  // Venue
1083
1090
  ["VENUE_BLOCKED" /* VENUE_BLOCKED */]: "Contract not in venue allowlist",
1084
1091
  ["INVALID_TARGET" /* INVALID_TARGET */]: "Target contract not allowed",
@@ -6299,7 +6306,7 @@ async function createSubWallet(params, runtime) {
6299
6306
  const walletAddress = await runtime.predictWalletAddress(params.parentWallet, salt);
6300
6307
  const isDeployed = await runtime.isWalletDeployed(walletAddress);
6301
6308
  if (!isDeployed) {
6302
- await runtime.deployWallet(params.parentWallet, salt);
6309
+ await runtime.deployWallet(params.parentWallet, salt, params.agentName);
6303
6310
  }
6304
6311
  const constraintData = buildAgentConstraints(
6305
6312
  params.constraints,
@@ -6345,7 +6352,19 @@ async function createSubWallet(params, runtime) {
6345
6352
  validFor: 86400
6346
6353
  // 24 hours
6347
6354
  });
6348
- const result = await runtime.bootstrapPolicy(bootstrapIntent);
6355
+ const result = await runtime.bootstrapPolicy(bootstrapIntent, {
6356
+ policyMode: "v3",
6357
+ delegationMode,
6358
+ leafAndProof: {
6359
+ leaf: constraintData.leafAndProof,
6360
+ proof: constraintData.proof ?? []
6361
+ },
6362
+ recipientProofs: constraintData.recipientProofs ? Object.fromEntries(
6363
+ Object.entries(constraintData.recipientProofs).map(([key, leaf]) => [key, { leaf, proof: [] }])
6364
+ ) : void 0,
6365
+ constraints: params.constraints,
6366
+ preset: params.preset
6367
+ });
6349
6368
  if (!result.success) {
6350
6369
  throw new Error(`Failed to create sub-wallet: ${result.error}`);
6351
6370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentlayer/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "TypeScript SDK for building, signing, and verifying intents on Intent Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",