@lit-protocol/vincent-app-sdk 2.6.1 → 2.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.7.0 (2026-01-30)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated ability-sdk to 3.0.2
6
+
1
7
  ## 2.6.1 (2026-01-17)
2
8
 
3
9
  ### 🧱 Updated Dependencies
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-protocol/vincent-app-sdk",
3
- "version": "2.6.1",
3
+ "version": "2.7.0-alpha",
4
4
  "description": "Vincent SDK for browser and backend",
5
5
  "author": "Lit Protocol",
6
6
  "license": "ISC",
@@ -65,6 +65,7 @@
65
65
  "@noble/secp256k1": "^2.2.3",
66
66
  "ethers": "5.8.0",
67
67
  "tslib": "^2.8.1",
68
+ "viem": "2.38.3",
68
69
  "zod": "3.25.64"
69
70
  },
70
71
  "peerDependencies": {
@@ -1,3 +1,5 @@
1
1
  export { getDelegatorsAgentPkpAddresses } from './delegation';
2
+ export { createVincentViemPkpSigner } from './vincentViemPkpSigner';
3
+ export { wrapKernelAccountWithUserOpCapture } from './wrapKernelAccountWithUserOpCapture';
2
4
  export type { GetDelegatorsAgentPkpsParams } from './types';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAE9D,YAAY,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE1F,YAAY,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC"}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDelegatorsAgentPkpAddresses = void 0;
3
+ exports.wrapKernelAccountWithUserOpCapture = exports.createVincentViemPkpSigner = exports.getDelegatorsAgentPkpAddresses = void 0;
4
4
  var delegation_1 = require("./delegation");
5
5
  Object.defineProperty(exports, "getDelegatorsAgentPkpAddresses", { enumerable: true, get: function () { return delegation_1.getDelegatorsAgentPkpAddresses; } });
6
+ var vincentViemPkpSigner_1 = require("./vincentViemPkpSigner");
7
+ Object.defineProperty(exports, "createVincentViemPkpSigner", { enumerable: true, get: function () { return vincentViemPkpSigner_1.createVincentViemPkpSigner; } });
8
+ var wrapKernelAccountWithUserOpCapture_1 = require("./wrapKernelAccountWithUserOpCapture");
9
+ Object.defineProperty(exports, "wrapKernelAccountWithUserOpCapture", { enumerable: true, get: function () { return wrapKernelAccountWithUserOpCapture_1.wrapKernelAccountWithUserOpCapture; } });
6
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAArD,4HAAA,8BAA8B,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAArD,4HAAA,8BAA8B,OAAA;AACvC,+DAAoE;AAA3D,kIAAA,0BAA0B,OAAA;AACnC,2FAA0F;AAAjF,wJAAA,kCAAkC,OAAA"}
@@ -0,0 +1,12 @@
1
+ import type { Address, Hex, LocalAccount } from 'viem';
2
+ export interface VincentViemPkpSignerParams {
3
+ pkpAddress: Address;
4
+ onSignUserOpHash: (params: {
5
+ userOpHash: Hex;
6
+ userOp: any;
7
+ }) => Promise<Hex>;
8
+ }
9
+ export declare function createVincentViemPkpSigner(params: VincentViemPkpSignerParams): LocalAccount & {
10
+ setCurrentUserOp: (userOp: any) => void;
11
+ };
12
+ //# sourceMappingURL=vincentViemPkpSigner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincentViemPkpSigner.d.ts","sourceRoot":"","sources":["../../../src/utils/vincentViemPkpSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAmB,MAAM,MAAM,CAAC;AAIxE,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC9E;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,0BAA0B,GACjC,YAAY,GAAG;IAAE,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;CAAE,CA0E5D"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createVincentViemPkpSigner = createVincentViemPkpSigner;
4
+ const accounts_1 = require("viem/accounts");
5
+ function createVincentViemPkpSigner(params) {
6
+ const { pkpAddress, onSignUserOpHash } = params;
7
+ let currentUserOp = null;
8
+ const account = (0, accounts_1.toAccount)({
9
+ address: pkpAddress,
10
+ async signMessage({ message }) {
11
+ console.log('[createVincentViemPkpSigner] signMessage called by ZeroDev');
12
+ console.log('message:', message);
13
+ console.log('message type:', typeof message);
14
+ console.log('currentUserOp status:', currentUserOp ? 'SET' : 'NOT SET');
15
+ let userOpHash;
16
+ if (typeof message === 'object' && 'raw' in message) {
17
+ userOpHash = message.raw;
18
+ console.log('message.raw (UserOp hash):', userOpHash);
19
+ if (!currentUserOp) {
20
+ throw new Error('[createVincentViemPkpSigner] currentUserOp is null, wrapKernelAccountWithUserOpCapture did not intercept correctly');
21
+ }
22
+ console.log('Full UserOp available for Lit Action:', JSON.stringify(currentUserOp, (key, value) => (typeof value === 'bigint' ? value.toString() : value), 2));
23
+ // Delegate signing to Lit Actions via callback
24
+ const signature = await onSignUserOpHash({
25
+ userOpHash,
26
+ userOp: currentUserOp,
27
+ });
28
+ // Clear the current UserOp after signing
29
+ currentUserOp = null;
30
+ return signature;
31
+ }
32
+ throw new Error('[createVincentViemPkpSigner] signMessage called without UserOp hash');
33
+ },
34
+ async signTransaction(transaction, options) {
35
+ console.log('[createVincentViemPkpSigner] signTransaction called by ZeroDev');
36
+ console.log('transaction:', JSON.stringify(transaction, null, 2));
37
+ console.log('options:', options);
38
+ throw new Error('[createVincentViemPkpSigner] signTransaction not supported - use signMessage for UserOps');
39
+ },
40
+ async signTypedData(parameters) {
41
+ console.log('[createVincentViemPkpSigner] signTypedData called by ZeroDev');
42
+ console.log('parameters:', JSON.stringify(parameters, null, 2));
43
+ throw new Error('[createVincentViemPkpSigner] signTypedData not supported - use signMessage for UserOps');
44
+ },
45
+ });
46
+ // Add method to set the current UserOp before signing
47
+ account.setCurrentUserOp = (userOp) => {
48
+ currentUserOp = userOp;
49
+ };
50
+ return account;
51
+ }
52
+ //# sourceMappingURL=vincentViemPkpSigner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincentViemPkpSigner.js","sourceRoot":"","sources":["../../../src/utils/vincentViemPkpSigner.ts"],"names":[],"mappings":";;AASA,gEA4EC;AAnFD,4CAA0C;AAO1C,SAAgB,0BAA0B,CACxC,MAAkC;IAElC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAAC;IAEhD,IAAI,aAAa,GAAQ,IAAI,CAAC;IAE9B,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC;QACxB,OAAO,EAAE,UAAU;QAEnB,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO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AAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAEjC,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,UAAe;YACjC,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;YAC5E,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAEhE,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAC;QACJ,CAAC;KACF,CAA+D,CAAC;IAEjE,sDAAsD;IACtD,OAAO,CAAC,gBAAgB,GAAG,CAAC,MAAW,EAAE,EAAE;QACzC,aAAa,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Wraps a kernel account to intercept UserOp preparation and provide it to the signer.
3
+ *
4
+ * This allows the signer to receive both the UserOp hash AND the full UserOp structure,
5
+ * which is needed for passing to Lit Actions for policy validation.
6
+ */
7
+ export declare function wrapKernelAccountWithUserOpCapture(kernelAccount: any, customSigner: any & {
8
+ setCurrentUserOp: (userOp: any) => void;
9
+ }): any;
10
+ //# sourceMappingURL=wrapKernelAccountWithUserOpCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapKernelAccountWithUserOpCapture.d.ts","sourceRoot":"","sources":["../../../src/utils/wrapKernelAccountWithUserOpCapture.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,aAAa,EAAE,GAAG,EAClB,YAAY,EAAE,GAAG,GAAG;IAAE,gBAAgB,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;CAAE,OA4BhE"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wrapKernelAccountWithUserOpCapture = wrapKernelAccountWithUserOpCapture;
4
+ /**
5
+ * Wraps a kernel account to intercept UserOp preparation and provide it to the signer.
6
+ *
7
+ * This allows the signer to receive both the UserOp hash AND the full UserOp structure,
8
+ * which is needed for passing to Lit Actions for policy validation.
9
+ */
10
+ function wrapKernelAccountWithUserOpCapture(kernelAccount, customSigner) {
11
+ return new Proxy(kernelAccount, {
12
+ get(target, prop) {
13
+ const original = target[prop];
14
+ // Intercept signUserOperation - this is where the UserOp is passed!
15
+ if (prop === 'signUserOperation') {
16
+ return async function (userOp) {
17
+ console.log('[wrapKernelAccount] Intercepted signUserOperation');
18
+ console.log('[wrapKernelAccount] UserOp keys:', Object.keys(userOp || {}));
19
+ // Provide the UserOp to the signer BEFORE signing
20
+ customSigner.setCurrentUserOp(userOp);
21
+ // Call the original signUserOperation method
22
+ const result = await original.call(target, userOp);
23
+ return result;
24
+ };
25
+ }
26
+ // Return original property/method
27
+ if (typeof original === 'function') {
28
+ return original.bind(target);
29
+ }
30
+ return original;
31
+ },
32
+ });
33
+ }
34
+ //# sourceMappingURL=wrapKernelAccountWithUserOpCapture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapKernelAccountWithUserOpCapture.js","sourceRoot":"","sources":["../../../src/utils/wrapKernelAccountWithUserOpCapture.ts"],"names":[],"mappings":";;AAMA,gFA8BC;AApCD;;;;;GAKG;AACH,SAAgB,kCAAkC,CAChD,aAAkB,EAClB,YAA+D;IAE/D,OAAO,IAAI,KAAK,CAAC,aAAa,EAAE;QAC9B,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAE9B,oEAAoE;YACpE,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACjC,OAAO,KAAK,WAAW,MAAW;oBAChC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;oBACjE,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;oBAE3E,kDAAkD;oBAClD,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAEtC,6CAA6C;oBAC7C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;oBACnD,OAAO,MAAM,CAAC;gBAChB,CAAC,CAAC;YACJ,CAAC;YAED,kCAAkC;YAClC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lit-protocol/vincent-app-sdk",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Vincent SDK for browser and backend",
5
5
  "author": "Lit Protocol",
6
6
  "license": "ISC",
@@ -57,8 +57,9 @@
57
57
  "@noble/secp256k1": "^2.2.3",
58
58
  "ethers": "5.8.0",
59
59
  "tslib": "^2.8.1",
60
+ "viem": "2.38.3",
60
61
  "zod": "3.25.64",
61
- "@lit-protocol/vincent-ability-sdk": "3.0.1",
62
+ "@lit-protocol/vincent-ability-sdk": "3.0.2",
62
63
  "@lit-protocol/vincent-contracts-sdk": "8.1.0"
63
64
  },
64
65
  "peerDependencies": {