@lit-protocol/vincent-ability-sdk 2.3.4 → 2.4.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 +26 -0
- package/README.md +49 -1
- package/dist/CHANGELOG.md +6 -0
- package/dist/README.md +49 -1
- package/dist/package.json +7 -1
- package/dist/src/gatedSigner.d.ts +2 -0
- package/dist/src/gatedSigner.d.ts.map +1 -0
- package/dist/src/gatedSigner.js +5 -0
- package/dist/src/gatedSigner.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js +1 -1
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js.map +1 -1
- package/dist/src/lib/gatedSigner/helpers/eip712.d.ts +34 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.js +30 -0
- package/dist/src/lib/gatedSigner/helpers/eip712.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/hex.d.ts +5 -0
- package/dist/src/lib/gatedSigner/helpers/hex.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/hex.js +16 -0
- package/dist/src/lib/gatedSigner/helpers/hex.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.d.ts +56 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.js +91 -0
- package/dist/src/lib/gatedSigner/helpers/lifecycleFunctions.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.d.ts +13 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.js +21 -0
- package/dist/src/lib/gatedSigner/helpers/lowLevelCall.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.d.ts +925 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.js +64 -0
- package/dist/src/lib/gatedSigner/helpers/schemas.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.d.ts +9 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.js +30 -0
- package/dist/src/lib/gatedSigner/helpers/signTransaction.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.d.ts +15 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.js +115 -0
- package/dist/src/lib/gatedSigner/helpers/signUserOperation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.d.ts +204 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.js +93 -0
- package/dist/src/lib/gatedSigner/helpers/simulation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.d.ts +8 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.js +177 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/kernel.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.d.ts +26 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.js +195 -0
- package/dist/src/lib/gatedSigner/helpers/smartAccounts/safe.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.d.ts +20 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.js +69 -0
- package/dist/src/lib/gatedSigner/helpers/toLitActionAccount.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.d.ts +148 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.js +87 -0
- package/dist/src/lib/gatedSigner/helpers/transaction.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.d.ts +200 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.js +106 -0
- package/dist/src/lib/gatedSigner/helpers/userOperation.js.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/validation.d.ts +43 -0
- package/dist/src/lib/gatedSigner/helpers/validation.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/helpers/validation.js +81 -0
- package/dist/src/lib/gatedSigner/helpers/validation.js.map +1 -0
- package/dist/src/lib/gatedSigner/index.d.ts +12 -0
- package/dist/src/lib/gatedSigner/index.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/index.js +19 -0
- package/dist/src/lib/gatedSigner/index.js.map +1 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.d.ts +566 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.d.ts.map +1 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.js +48 -0
- package/dist/src/lib/gatedSigner/vincentGatedSignerAbility.js.map +1 -0
- package/dist/src/type-inference-verification/ability-definition-tests.d.ts +6 -6
- package/dist/src/type-inference-verification/allow-deny-test-cases-ability.d.ts +90 -90
- package/dist/src/type-inference-verification/allow-deny-test-cases.d.ts +8 -8
- package/dist/src/type-inference-verification/context-switching-tests.d.ts +3 -3
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.d.ts +533 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.d.ts.map +1 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.js +19 -0
- package/dist/src/type-inference-verification/create-vincent-gated-signer-ability.js.map +1 -0
- package/dist/src/type-inference-verification/parameter-inference-tests-tool.d.ts +58 -58
- package/dist/src/type-inference-verification/parameter-inference-tests.d.ts +5 -5
- package/dist/src/type-inference-verification/playground.d.ts +8 -8
- package/dist/src/type-inference-verification/schema-test.d.ts +5 -5
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## 2.4.0 (2026-01-07)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- feat: add Relay.link gated signer ability ([3eec29cb](https://github.com/LIT-Protocol/Vincent/commit/3eec29cb))
|
|
6
|
+
- **ability-relay-link**: New package - a Vincent Ability that acts as a secure gated signer for Relay.link swap operations. Supports ERC-4337 Smart Accounts (ZeroDev, Crossmint, Safe) and EOAs. Includes transaction decoding, simulation-based validation, and helpers for building/submitting UserOps.
|
|
7
|
+
- **ability-sdk**: Allow `validateSimulation` and `validateTransaction` lifecycle functions to be async to support dynamic address fetching.
|
|
8
|
+
- **e2e-test-utils**: Add Safe account setup helper, export Crossmint client from setup function, and rename `TEST_PLATFORM_USER_WALLET_OWNER_PRIVATE_KEY` env var to `TEST_AGENT_WALLET_PKP_OWNER_PRIVATE_KEY`. Update ENVs to be more chain-abstract.
|
|
9
|
+
|
|
10
|
+
- Export Vincent Gated Signer abilities builder function and use it in the aave ability to convert it into a gated signer one ([ce148136](https://github.com/LIT-Protocol/Vincent/commit/ce148136))
|
|
11
|
+
|
|
12
|
+
### 🩹 Fixes
|
|
13
|
+
|
|
14
|
+
- Fix address checksum format ([#437](https://github.com/LIT-Protocol/Vincent/pull/437))
|
|
15
|
+
- Export simulation type ([#434](https://github.com/LIT-Protocol/Vincent/pull/434))
|
|
16
|
+
|
|
17
|
+
### 🧱 Updated Dependencies
|
|
18
|
+
|
|
19
|
+
- Updated contracts-sdk to 6.0.0
|
|
20
|
+
|
|
21
|
+
### ❤️ Thank You
|
|
22
|
+
|
|
23
|
+
- awisniew207 @awisniew207
|
|
24
|
+
- Federico Amura @FedericoAmura
|
|
25
|
+
- FedericoAmura @FedericoAmura
|
|
26
|
+
|
|
1
27
|
## 2.3.4 (2025-11-23)
|
|
2
28
|
|
|
3
29
|
### 🧱 Updated Dependencies
|
package/README.md
CHANGED
|
@@ -208,6 +208,54 @@ export const myTokenSwapAbility = createVincentAbility({
|
|
|
208
208
|
});
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Gated Signer Ability
|
|
214
|
+
|
|
215
|
+
A **Gated Signer Ability** is a specialized ability designed to validate and sign EOA transactions or AA user operations. It enforces a strict validation lifecycle before using the delegated PKP to sign the request.
|
|
216
|
+
|
|
217
|
+
#### Lifecycle
|
|
218
|
+
|
|
219
|
+
1. **Decode**: The ability decodes the transaction data using the provided `decodeTransaction` function.
|
|
220
|
+
2. **Simulation**: The ability simulates the transaction/userOperation on-chain to determine asset changes.
|
|
221
|
+
3. **Validate Simulation**: The `validateSimulation` function checks if the simulation results are acceptable (e.g., no unexpected asset transfers).
|
|
222
|
+
4. **Validate Transaction**: The `validateTransaction` function inspects the decoded transaction to ensure it complies with security policies (e.g., allowed contracts, methods, arguments).
|
|
223
|
+
5. **Sign**: If all validations pass, the ability signs the transaction or userOperation using the PKP.
|
|
224
|
+
|
|
225
|
+
#### Creating a Gated Signer Ability
|
|
226
|
+
|
|
227
|
+
You can create a Gated Signer Ability using `createVincentGatedSignerAbility`:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { createVincentGatedSignerAbility } from '@lit-protocol/vincent-ability-sdk/gatedSigner';
|
|
231
|
+
|
|
232
|
+
import { decodeTransaction } from './decodeTransaction';
|
|
233
|
+
import { validateSimulation } from './validateSimulation';
|
|
234
|
+
import { validateTransaction } from './validateTransaction';
|
|
235
|
+
|
|
236
|
+
export const myGatedSignerAbility = createVincentGatedSignerAbility({
|
|
237
|
+
packageName: '@my-org/my-gated-signer',
|
|
238
|
+
abilityDescription: 'Safely signs transactions for My Protocol',
|
|
239
|
+
|
|
240
|
+
// Lifecycle functions
|
|
241
|
+
decodeTransaction,
|
|
242
|
+
validateSimulation,
|
|
243
|
+
validateTransaction,
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The lifecycle functions must implement the `LifecycleFunctionSteps` interface:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
interface LifecycleFunctionSteps {
|
|
251
|
+
decodeTransaction: (params: DecodeTransactionParams) => DecodedTransaction;
|
|
252
|
+
validateSimulation: (params: ValidateSimulationParams) => void;
|
|
253
|
+
validateTransaction: (params: ValidateTransactionParams) => void;
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
This abstraction simplifies the creation of abilities that act as secure signers, ensuring consistent validation logic across different implementations.
|
|
258
|
+
|
|
211
259
|
## Tip
|
|
212
260
|
|
|
213
|
-
Ability and policy authors should export the result of `createVincentPolicy()` / `createVincentAbility()`
|
|
261
|
+
Ability and policy authors should export the result of `createVincentPolicy()` / `createVincentAbility()` / `createVincentGatedSignerAbility()`
|
package/dist/CHANGELOG.md
CHANGED
package/dist/README.md
CHANGED
|
@@ -208,6 +208,54 @@ export const myTokenSwapAbility = createVincentAbility({
|
|
|
208
208
|
});
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Gated Signer Ability
|
|
214
|
+
|
|
215
|
+
A **Gated Signer Ability** is a specialized ability designed to validate and sign EOA transactions or AA user operations. It enforces a strict validation lifecycle before using the delegated PKP to sign the request.
|
|
216
|
+
|
|
217
|
+
#### Lifecycle
|
|
218
|
+
|
|
219
|
+
1. **Decode**: The ability decodes the transaction data using the provided `decodeTransaction` function.
|
|
220
|
+
2. **Simulation**: The ability simulates the transaction/userOperation on-chain to determine asset changes.
|
|
221
|
+
3. **Validate Simulation**: The `validateSimulation` function checks if the simulation results are acceptable (e.g., no unexpected asset transfers).
|
|
222
|
+
4. **Validate Transaction**: The `validateTransaction` function inspects the decoded transaction to ensure it complies with security policies (e.g., allowed contracts, methods, arguments).
|
|
223
|
+
5. **Sign**: If all validations pass, the ability signs the transaction or userOperation using the PKP.
|
|
224
|
+
|
|
225
|
+
#### Creating a Gated Signer Ability
|
|
226
|
+
|
|
227
|
+
You can create a Gated Signer Ability using `createVincentGatedSignerAbility`:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { createVincentGatedSignerAbility } from '@lit-protocol/vincent-ability-sdk/gatedSigner';
|
|
231
|
+
|
|
232
|
+
import { decodeTransaction } from './decodeTransaction';
|
|
233
|
+
import { validateSimulation } from './validateSimulation';
|
|
234
|
+
import { validateTransaction } from './validateTransaction';
|
|
235
|
+
|
|
236
|
+
export const myGatedSignerAbility = createVincentGatedSignerAbility({
|
|
237
|
+
packageName: '@my-org/my-gated-signer',
|
|
238
|
+
abilityDescription: 'Safely signs transactions for My Protocol',
|
|
239
|
+
|
|
240
|
+
// Lifecycle functions
|
|
241
|
+
decodeTransaction,
|
|
242
|
+
validateSimulation,
|
|
243
|
+
validateTransaction,
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The lifecycle functions must implement the `LifecycleFunctionSteps` interface:
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
interface LifecycleFunctionSteps {
|
|
251
|
+
decodeTransaction: (params: DecodeTransactionParams) => DecodedTransaction;
|
|
252
|
+
validateSimulation: (params: ValidateSimulationParams) => void;
|
|
253
|
+
validateTransaction: (params: ValidateTransactionParams) => void;
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
This abstraction simplifies the creation of abilities that act as secure signers, ensuring consistent validation logic across different implementations.
|
|
258
|
+
|
|
211
259
|
## Tip
|
|
212
260
|
|
|
213
|
-
Ability and policy authors should export the result of `createVincentPolicy()` / `createVincentAbility()`
|
|
261
|
+
Ability and policy authors should export the result of `createVincentPolicy()` / `createVincentAbility()` / `createVincentGatedSignerAbility()`
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-ability-sdk",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"ethers-v6": "npm:ethers@^6",
|
|
13
13
|
"semver": "^7.7.2",
|
|
14
14
|
"tslib": "^2.8.1",
|
|
15
|
+
"viem": "^2.40.3",
|
|
15
16
|
"zod": "^3.25.64"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
@@ -32,6 +33,11 @@
|
|
|
32
33
|
"./internal": {
|
|
33
34
|
"require": "./dist/src/internal.js",
|
|
34
35
|
"import": "./dist/src/internal.js"
|
|
36
|
+
},
|
|
37
|
+
"./gatedSigner": {
|
|
38
|
+
"require": "./dist/src/gatedSigner.js",
|
|
39
|
+
"import": "./dist/src/gatedSigner.js",
|
|
40
|
+
"types": "./dist/src/gatedSigner.d.ts"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gatedSigner.d.ts","sourceRoot":"","sources":["../../src/gatedSigner.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gatedSigner.js","sourceRoot":"","sources":["../../src/gatedSigner.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-alchemy-chain-config.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.ts"],"names":[],"mappings":";;AAsDA,sDA6DC;AAnHD,8CA8C4B;AAE5B;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAe;IACnD,uCAAuC;IACvC,MAAM,eAAe,GAAG;QACtB,gBAAQ;QACR,sBAAc;QACd,oBAAY;QACZ,uBAAe;QACf,YAAI;QACJ,kBAAU;QACV,mBAAW;QACX,eAAO;QACP,sBAAc;QACd,cAAM;QACN,eAAO;QACP,gBAAQ;QACR,sBAAc;QACd,uBAAe;QACf,eAAO;QACP,mBAAW;QACX,qBAAa;QACb,eAAO;QACP,aAAK;QACL,oBAAY;QACZ,kBAAU;QACV,yBAAiB;QACjB,YAAI;QACJ,mBAAW;QACX,uBAAe;QACf,oBAAY;QACZ,oBAAY;QACZ,qBAAa;QACb,sBAAc;QACd,uBAAe;QACf,uBAAe;QACf,kBAAU;QACV,kBAAU;QACV,cAAM;QACN,oBAAY;QACZ,uBAAe;QACf,qBAAa;QACb,mBAAW;QACX,oBAAY;QACZ,mBAAW;QACX,
|
|
1
|
+
{"version":3,"file":"get-alchemy-chain-config.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.ts"],"names":[],"mappings":";;AAsDA,sDA6DC;AAnHD,8CA8C4B;AAE5B;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAe;IACnD,uCAAuC;IACvC,MAAM,eAAe,GAAG;QACtB,gBAAQ;QACR,sBAAc;QACd,oBAAY;QACZ,uBAAe;QACf,YAAI;QACJ,kBAAU;QACV,mBAAW;QACX,eAAO;QACP,sBAAc;QACd,cAAM;QACN,eAAO;QACP,gBAAQ;QACR,sBAAc;QACd,uBAAe;QACf,eAAO;QACP,mBAAW;QACX,qBAAa;QACb,eAAO;QACP,aAAK;QACL,oBAAY;QACZ,kBAAU;QACV,yBAAiB;QACjB,YAAI;QACJ,mBAAW;QACX,uBAAe;QACf,oBAAY;QACZ,oBAAY;QACZ,qBAAa;QACb,sBAAc;QACd,uBAAe;QACf,uBAAe;QACf,kBAAU;QACV,kBAAU;QACV,cAAM;QACN,oBAAY;QACZ,uBAAe;QACf,qBAAa;QACb,mBAAW;QACX,oBAAY;QACZ,mBAAW;QACX,mBAAW;QACX,mBAAW;QACX,kBAAU;QACV,mBAAW;QACX,mBAAW;KACZ,CAAC;IAEF,oDAAoD;IACpD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IAE5D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,wCAAwC;YACzD,wBAAwB,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxE,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const eip712ParamsSchema: z.ZodObject<{
|
|
3
|
+
domain: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
4
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
type: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
type: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}>, "many">>;
|
|
14
|
+
primaryType: z.ZodString;
|
|
15
|
+
message: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, Record<string, string | Record<string, any>>, Record<string, string | Record<string, any>>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
message: Record<string, string | Record<string, any>>;
|
|
18
|
+
domain: Record<string, any>;
|
|
19
|
+
types: Record<string, {
|
|
20
|
+
type: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}[]>;
|
|
23
|
+
primaryType: string;
|
|
24
|
+
}, {
|
|
25
|
+
message: Record<string, string | Record<string, any>>;
|
|
26
|
+
domain: Record<string, any>;
|
|
27
|
+
types: Record<string, {
|
|
28
|
+
type: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}[]>;
|
|
31
|
+
primaryType: string;
|
|
32
|
+
}>;
|
|
33
|
+
export type Eip712Params = z.infer<typeof eip712ParamsSchema>;
|
|
34
|
+
//# sourceMappingURL=eip712.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/eip712.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkC7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eip712ParamsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.eip712ParamsSchema = zod_1.z.object({
|
|
6
|
+
domain: zod_1.z.record(zod_1.z.any()).describe('EIP-712 domain'),
|
|
7
|
+
types: zod_1.z
|
|
8
|
+
.record(zod_1.z.array(zod_1.z.object({ name: zod_1.z.string(), type: zod_1.z.string() })))
|
|
9
|
+
.describe('EIP-712 types'),
|
|
10
|
+
primaryType: zod_1.z.string().describe('EIP-712 primary type'),
|
|
11
|
+
message: zod_1.z
|
|
12
|
+
.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.string(), zod_1.z.any())]))
|
|
13
|
+
.describe('EIP-712 message template. Values must be strings starting with $ that resolve to a valid param (e.g. $userOp.sender, $validUntil).')
|
|
14
|
+
.refine((data) => {
|
|
15
|
+
const validateValue = (value) => {
|
|
16
|
+
if (typeof value === 'string') {
|
|
17
|
+
return (value.startsWith('$') &&
|
|
18
|
+
/^\$(userOp\.(sender|nonce|initCode|callData|callGasLimit|verificationGasLimit|preVerificationGas|maxFeePerGas|maxPriorityFeePerGas|paymasterAndData|signature|factory|factoryData|paymaster|paymasterData|paymasterPostOpGasLimit|paymasterVerificationGasLimit)|entryPointAddress|validAfter|validUntil|safe4337ModuleAddress)$/.test(value));
|
|
19
|
+
}
|
|
20
|
+
if (typeof value === 'object' && value !== null) {
|
|
21
|
+
return Object.values(value).every(validateValue);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
return Object.values(data).every(validateValue);
|
|
26
|
+
}, {
|
|
27
|
+
message: 'Invalid message value. Must be a reference string starting with $ (e.g. $userOp.sender) or a nested object containing references.',
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=eip712.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/eip712.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACpD,KAAK,EAAE,OAAC;SACL,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;SACjE,QAAQ,CAAC,eAAe,CAAC;IAC5B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACxD,OAAO,EAAE,OAAC;SACP,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;SACxE,QAAQ,CACP,oIAAoI,CACrI;SACA,MAAM,CACL,CAAC,IAAI,EAAE,EAAE;QACP,MAAM,aAAa,GAAG,CAAC,KAAU,EAAW,EAAE;YAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,CACL,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;oBACrB,kUAAkU,CAAC,IAAI,CACrU,KAAK,CACN,CACF,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAChD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC;QACF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC,EACD;QACE,OAAO,EACL,mIAAmI;KACtI,CACF;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addressSchema: z.ZodEffects<z.ZodString, `0x${string}`, string>;
|
|
3
|
+
export declare const hexSchema: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
4
|
+
export declare const hexOfBytesSchema: (bytes: number) => z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
5
|
+
//# sourceMappingURL=hex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/hex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa,kDAItB,CAAC;AAEL,eAAO,MAAM,SAAS,uDAEpB,CAAC;AAEH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,0DAI3C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hexOfBytesSchema = exports.hexSchema = exports.addressSchema = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.addressSchema = zod_1.z
|
|
7
|
+
.string()
|
|
8
|
+
.refine((v) => (0, viem_1.isAddress)(v, { strict: false }), {
|
|
9
|
+
message: 'Invalid Ethereum address',
|
|
10
|
+
});
|
|
11
|
+
exports.hexSchema = zod_1.z.custom((v) => typeof v === 'string' && (0, viem_1.isHex)(v, { strict: true }), {
|
|
12
|
+
message: 'Invalid hex (must be 0x-prefixed, even length)',
|
|
13
|
+
});
|
|
14
|
+
const hexOfBytesSchema = (bytes) => zod_1.z.custom((v) => typeof v === 'string' && (0, viem_1.isHex)(v, { strict: true }) && (v.length - 2) / 2 === bytes, { message: `Invalid hex (must be 0x + ${bytes} bytes)` });
|
|
15
|
+
exports.hexOfBytesSchema = hexOfBytesSchema;
|
|
16
|
+
//# sourceMappingURL=hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/hex.ts"],"names":[],"mappings":";;;AAEA,+BAAwC;AACxC,6BAAwB;AAEX,QAAA,aAAa,GAAG,OAAC;KAC3B,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,IAAA,gBAAS,EAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE;IAC5D,OAAO,EAAE,0BAA0B;CACpC,CAAC,CAAC;AAEQ,QAAA,SAAS,GAAG,OAAC,CAAC,MAAM,CAAM,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,IAAA,YAAK,EAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;IACjG,OAAO,EAAE,gDAAgD;CAC1D,CAAC,CAAC;AAEI,MAAM,gBAAgB,GAAG,CAAC,KAAa,EAAE,EAAE,CAChD,OAAC,CAAC,MAAM,CACN,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,IAAA,YAAK,EAAC,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,EAC1F,EAAE,OAAO,EAAE,6BAA6B,KAAK,SAAS,EAAE,CACzD,CAAC;AAJS,QAAA,gBAAgB,oBAIzB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { AbilityConfigLifecycleFunction } from '../../abilityCore/abilityConfig/types';
|
|
4
|
+
import type { LowLevelCall } from './lowLevelCall';
|
|
5
|
+
import type { SimulateAssetChangesResponse } from './simulation';
|
|
6
|
+
export interface DecodedTransactionError {
|
|
7
|
+
kind: 'error';
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DecodedTransactionSuccess extends Omit<LowLevelCall, 'data'> {
|
|
11
|
+
args: readonly unknown[] | undefined;
|
|
12
|
+
kind: string;
|
|
13
|
+
fn: string;
|
|
14
|
+
}
|
|
15
|
+
export type DecodedTransaction = DecodedTransactionSuccess | DecodedTransactionError;
|
|
16
|
+
interface ValidationBaseParams {
|
|
17
|
+
chainId: number;
|
|
18
|
+
sender: Address;
|
|
19
|
+
}
|
|
20
|
+
export interface DecodeTransactionParams {
|
|
21
|
+
transaction: LowLevelCall;
|
|
22
|
+
}
|
|
23
|
+
export interface ValidateSimulationParams extends ValidationBaseParams {
|
|
24
|
+
simulation: SimulateAssetChangesResponse;
|
|
25
|
+
}
|
|
26
|
+
export interface ValidateTransactionParams extends ValidationBaseParams {
|
|
27
|
+
decodedTransaction: DecodedTransaction;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Interface defining the steps required to implement the lifecycle of a Gated Signer Ability.
|
|
31
|
+
*/
|
|
32
|
+
export interface LifecycleFunctionSteps {
|
|
33
|
+
/**
|
|
34
|
+
* Decodes the transaction data into a more usable format.
|
|
35
|
+
*/
|
|
36
|
+
decodeTransaction: (params: DecodeTransactionParams) => DecodedTransaction;
|
|
37
|
+
/**
|
|
38
|
+
* Validates the result of the simulation.
|
|
39
|
+
* Should throw an error if the simulation result is invalid.
|
|
40
|
+
* Can be async to support dynamic address fetching.
|
|
41
|
+
*/
|
|
42
|
+
validateSimulation: (params: ValidateSimulationParams) => void | Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Validates the decoded transaction.
|
|
45
|
+
* Should throw an error if the transaction is invalid.
|
|
46
|
+
* Can be async to support dynamic address fetching.
|
|
47
|
+
*/
|
|
48
|
+
validateTransaction: (params: ValidateTransactionParams) => void | Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
interface LifecycleFunctions<AbilityParamsSchema extends z.ZodType, ExecutePolicies, PrecheckPolicies, ExecuteSuccessSchema extends z.ZodType, ExecuteFailSchema extends z.ZodType, PrecheckSuccessSchema extends z.ZodType, PrecheckFailSchema extends z.ZodType> {
|
|
51
|
+
execute: AbilityConfigLifecycleFunction<AbilityParamsSchema, ExecutePolicies, ExecuteSuccessSchema, ExecuteFailSchema>;
|
|
52
|
+
precheck: AbilityConfigLifecycleFunction<AbilityParamsSchema, PrecheckPolicies, PrecheckSuccessSchema, PrecheckFailSchema>;
|
|
53
|
+
}
|
|
54
|
+
export declare function buildLifecycleFunctions<AbilityParamsSchema extends z.ZodType, ExecutePolicies, PrecheckPolicies, ExecuteSuccessSchema extends z.ZodType, ExecuteFailSchema extends z.ZodType, PrecheckSuccessSchema extends z.ZodType, PrecheckFailSchema extends z.ZodType>({ decodeTransaction, validateSimulation, validateTransaction, }: LifecycleFunctionSteps): LifecycleFunctions<AbilityParamsSchema, ExecutePolicies, PrecheckPolicies, ExecuteSuccessSchema, ExecuteFailSchema, PrecheckSuccessSchema, PrecheckFailSchema>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=lifecycleFunctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycleFunctions.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/lifecycleFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAO,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAOjE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC;IAC3E,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,GAAG,uBAAuB,CAAC;AAErF,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,YAAY,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,UAAU,EAAE,4BAA4B,CAAC;CAC1C;AAED,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,kBAAkB,EAAE,kBAAkB,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,iBAAiB,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,kBAAkB,CAAC;IAC3E;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,wBAAwB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,yBAAyB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClF;AAED,UAAU,kBAAkB,CAC1B,mBAAmB,SAAS,CAAC,CAAC,OAAO,EACrC,eAAe,EACf,gBAAgB,EAChB,oBAAoB,SAAS,CAAC,CAAC,OAAO,EACtC,iBAAiB,SAAS,CAAC,CAAC,OAAO,EACnC,qBAAqB,SAAS,CAAC,CAAC,OAAO,EACvC,kBAAkB,SAAS,CAAC,CAAC,OAAO;IAEpC,OAAO,EAAE,8BAA8B,CACrC,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,CAClB,CAAC;IACF,QAAQ,EAAE,8BAA8B,CACtC,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,CACnB,CAAC;CACH;AAED,wBAAgB,uBAAuB,CACrC,mBAAmB,SAAS,CAAC,CAAC,OAAO,EACrC,eAAe,EACf,gBAAgB,EAChB,oBAAoB,SAAS,CAAC,CAAC,OAAO,EACtC,iBAAiB,SAAS,CAAC,CAAC,OAAO,EACnC,qBAAqB,SAAS,CAAC,CAAC,OAAO,EACvC,kBAAkB,SAAS,CAAC,CAAC,OAAO,EACpC,EACA,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACpB,EAAE,sBAAsB,GAAG,kBAAkB,CAC5C,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,CACnB,CAqHA"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildLifecycleFunctions = buildLifecycleFunctions;
|
|
4
|
+
const schemas_1 = require("./schemas");
|
|
5
|
+
const signTransaction_1 = require("./signTransaction");
|
|
6
|
+
const signUserOperation_1 = require("./signUserOperation");
|
|
7
|
+
const validation_1 = require("./validation");
|
|
8
|
+
function buildLifecycleFunctions({ decodeTransaction, validateSimulation, validateTransaction, }) {
|
|
9
|
+
async function assertIsValidOperation(abilityParams) {
|
|
10
|
+
if ((0, schemas_1.isUserOpAbilityParams)(abilityParams)) {
|
|
11
|
+
const { alchemyRpcUrl, entryPointAddress, userOp } = abilityParams;
|
|
12
|
+
const simulationChanges = await (0, validation_1.assertIsValidUserOp)({
|
|
13
|
+
alchemyRpcUrl,
|
|
14
|
+
decodeTransaction,
|
|
15
|
+
entryPointAddress,
|
|
16
|
+
userOp,
|
|
17
|
+
validateSimulation,
|
|
18
|
+
validateTransaction,
|
|
19
|
+
});
|
|
20
|
+
return simulationChanges;
|
|
21
|
+
}
|
|
22
|
+
if ((0, schemas_1.isTransactionAbilityParams)(abilityParams)) {
|
|
23
|
+
const { alchemyRpcUrl, transaction } = abilityParams;
|
|
24
|
+
const simulationChanges = await (0, validation_1.assertIsValidTransaction)({
|
|
25
|
+
alchemyRpcUrl,
|
|
26
|
+
decodeTransaction,
|
|
27
|
+
transaction,
|
|
28
|
+
validateSimulation,
|
|
29
|
+
validateTransaction,
|
|
30
|
+
});
|
|
31
|
+
return simulationChanges;
|
|
32
|
+
}
|
|
33
|
+
throw new Error('Unsupported ability params payload. Must pass transaction or userOp');
|
|
34
|
+
}
|
|
35
|
+
const precheck = async ({ abilityParams }, { succeed, fail, delegation: { delegatorPkpInfo } }) => {
|
|
36
|
+
try {
|
|
37
|
+
console.log('[@lit-protocol/vincent-gated-signer]');
|
|
38
|
+
console.log('[@lit-protocol/vincent-gated-signer] params:', {
|
|
39
|
+
abilityParams,
|
|
40
|
+
});
|
|
41
|
+
console.log('[@lit-protocol/vincent-gated-signer] delegator:', {
|
|
42
|
+
delegatorPkpInfo,
|
|
43
|
+
});
|
|
44
|
+
const simulationChanges = await assertIsValidOperation(abilityParams);
|
|
45
|
+
return succeed({ simulationChanges });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
console.error('[@lit-protocol/vincent-gated-signer] Error:', error);
|
|
49
|
+
return fail({
|
|
50
|
+
error: `[@lit-protocol/vincent-gated-signer] Precheck failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const execute = async ({ abilityParams }, { succeed, fail, delegation: { delegatorPkpInfo } }) => {
|
|
55
|
+
try {
|
|
56
|
+
const simulationChanges = await assertIsValidOperation(abilityParams);
|
|
57
|
+
// Sign user operation
|
|
58
|
+
const { alchemyRpcUrl, eip712Params, entryPointAddress, safe4337ModuleAddress, transaction, userOp, validAfter, validUntil, } = abilityParams;
|
|
59
|
+
const signature = (0, schemas_1.isTransactionAbilityParams)(abilityParams)
|
|
60
|
+
? await (0, signTransaction_1.signTransaction)({
|
|
61
|
+
transaction,
|
|
62
|
+
pkpPublicKey: delegatorPkpInfo.publicKey,
|
|
63
|
+
})
|
|
64
|
+
: await (0, signUserOperation_1.signUserOperation)({
|
|
65
|
+
alchemyRpcUrl,
|
|
66
|
+
entryPointAddress,
|
|
67
|
+
userOp,
|
|
68
|
+
pkpPublicKey: delegatorPkpInfo.publicKey,
|
|
69
|
+
validAfter,
|
|
70
|
+
validUntil,
|
|
71
|
+
safe4337ModuleAddress,
|
|
72
|
+
eip712Params,
|
|
73
|
+
});
|
|
74
|
+
return succeed({
|
|
75
|
+
signature,
|
|
76
|
+
simulationChanges,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error('[@lit-protocol/vincent-gated-signer] Error:', error);
|
|
81
|
+
return fail({
|
|
82
|
+
error: `[@lit-protocol/vincent-gated-signer] Execute failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
execute,
|
|
88
|
+
precheck,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=lifecycleFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycleFunctions.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/lifecycleFunctions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
import type { UserOp } from './userOperation';
|
|
3
|
+
export interface LowLevelCall {
|
|
4
|
+
to: Address;
|
|
5
|
+
value: bigint;
|
|
6
|
+
data: Hex;
|
|
7
|
+
}
|
|
8
|
+
export interface DecodedFunctionCall<Args = unknown[] | null> {
|
|
9
|
+
functionName: string;
|
|
10
|
+
args: Args;
|
|
11
|
+
}
|
|
12
|
+
export declare const getUserOpCalls: (userOp: UserOp) => LowLevelCall[];
|
|
13
|
+
//# sourceMappingURL=lowLevelCall.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lowLevelCall.d.ts","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/lowLevelCall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,OAAO,EAAE,GAAG,IAAI;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,YAAY,EAiB3D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserOpCalls = void 0;
|
|
4
|
+
const kernel_1 = require("./smartAccounts/kernel");
|
|
5
|
+
const safe_1 = require("./smartAccounts/safe");
|
|
6
|
+
const getUserOpCalls = (userOp) => {
|
|
7
|
+
const callData = userOp.callData;
|
|
8
|
+
const kernelCalls = (0, kernel_1.tryDecodeKernelCalldataToLowLevelCalls)(callData);
|
|
9
|
+
const safeCalls = (0, safe_1.tryDecodeSafeCalldataToLowLevelCalls)(callData);
|
|
10
|
+
const decodedLowLevelCalls = [kernelCalls, safeCalls].filter(Boolean);
|
|
11
|
+
if (decodedLowLevelCalls.length > 1) {
|
|
12
|
+
throw new Error('Multiple decodings found');
|
|
13
|
+
}
|
|
14
|
+
else if (!decodedLowLevelCalls.length) {
|
|
15
|
+
throw new Error('Unsupported callData shape');
|
|
16
|
+
}
|
|
17
|
+
// Length is 1, we are good
|
|
18
|
+
return decodedLowLevelCalls[0];
|
|
19
|
+
};
|
|
20
|
+
exports.getUserOpCalls = getUserOpCalls;
|
|
21
|
+
//# sourceMappingURL=lowLevelCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lowLevelCall.js","sourceRoot":"","sources":["../../../../../src/lib/gatedSigner/helpers/lowLevelCall.ts"],"names":[],"mappings":";;;AAIA,mDAAgF;AAChF,+CAA4E;AAarE,MAAM,cAAc,GAAG,CAAC,MAAc,EAAkB,EAAE;IAC/D,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAEjC,MAAM,WAAW,GAAG,IAAA,+CAAsC,EAAC,QAAQ,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,IAAA,2CAAoC,EAAC,QAAQ,CAAC,CAAC;IAEjE,MAAM,oBAAoB,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,MAAM,CAC1D,OAAO,CACuB,CAAC;IACjC,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;SAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,2BAA2B;IAC3B,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB"}
|