@lit-protocol/vincent-ability-relay-link 1.0.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/CONTRIBUTING.md +82 -0
  3. package/README.md +223 -0
  4. package/dist/CHANGELOG.md +0 -0
  5. package/dist/CONTRIBUTING.md +82 -0
  6. package/dist/README.md +223 -0
  7. package/dist/package.json +37 -0
  8. package/dist/src/generated/lit-action.js +9 -0
  9. package/dist/src/generated/vincent-ability-metadata.json +3 -0
  10. package/dist/src/generated/vincent-bundled-ability.d.ts +1440 -0
  11. package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
  12. package/dist/src/generated/vincent-bundled-ability.js +15 -0
  13. package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
  14. package/dist/src/generated/vincent-bundled-ability.ts +13 -0
  15. package/dist/src/index.d.ts +7 -0
  16. package/dist/src/index.d.ts.map +1 -0
  17. package/dist/src/index.js +29 -0
  18. package/dist/src/index.js.map +1 -0
  19. package/dist/src/lib/decodeTransaction.d.ts +3 -0
  20. package/dist/src/lib/decodeTransaction.d.ts.map +1 -0
  21. package/dist/src/lib/decodeTransaction.js +48 -0
  22. package/dist/src/lib/decodeTransaction.js.map +1 -0
  23. package/dist/src/lib/helpers/crossmint.d.ts +37 -0
  24. package/dist/src/lib/helpers/crossmint.d.ts.map +1 -0
  25. package/dist/src/lib/helpers/crossmint.js +50 -0
  26. package/dist/src/lib/helpers/crossmint.js.map +1 -0
  27. package/dist/src/lib/helpers/relay-link.d.ts +71 -0
  28. package/dist/src/lib/helpers/relay-link.d.ts.map +1 -0
  29. package/dist/src/lib/helpers/relay-link.js +157 -0
  30. package/dist/src/lib/helpers/relay-link.js.map +1 -0
  31. package/dist/src/lib/helpers/safe.d.ts +52 -0
  32. package/dist/src/lib/helpers/safe.d.ts.map +1 -0
  33. package/dist/src/lib/helpers/safe.js +98 -0
  34. package/dist/src/lib/helpers/safe.js.map +1 -0
  35. package/dist/src/lib/helpers/transactionKind.d.ts +5 -0
  36. package/dist/src/lib/helpers/transactionKind.d.ts.map +1 -0
  37. package/dist/src/lib/helpers/transactionKind.js +9 -0
  38. package/dist/src/lib/helpers/transactionKind.js.map +1 -0
  39. package/dist/src/lib/helpers/zerodev.d.ts +58 -0
  40. package/dist/src/lib/helpers/zerodev.d.ts.map +1 -0
  41. package/dist/src/lib/helpers/zerodev.js +127 -0
  42. package/dist/src/lib/helpers/zerodev.js.map +1 -0
  43. package/dist/src/lib/lit-action.d.ts +2 -0
  44. package/dist/src/lib/lit-action.d.ts.map +1 -0
  45. package/dist/src/lib/lit-action.js +15 -0
  46. package/dist/src/lib/lit-action.js.map +1 -0
  47. package/dist/src/lib/validateSimulation.d.ts +3 -0
  48. package/dist/src/lib/validateSimulation.d.ts.map +1 -0
  49. package/dist/src/lib/validateSimulation.js +116 -0
  50. package/dist/src/lib/validateSimulation.js.map +1 -0
  51. package/dist/src/lib/validateTransaction.d.ts +3 -0
  52. package/dist/src/lib/validateTransaction.d.ts.map +1 -0
  53. package/dist/src/lib/validateTransaction.js +44 -0
  54. package/dist/src/lib/validateTransaction.js.map +1 -0
  55. package/dist/src/lib/vincent-ability.d.ts +1437 -0
  56. package/dist/src/lib/vincent-ability.d.ts.map +1 -0
  57. package/dist/src/lib/vincent-ability.js +15 -0
  58. package/dist/src/lib/vincent-ability.js.map +1 -0
  59. package/package.json +36 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # 1.0.0 (2026-01-07)
2
+
3
+ ### ⚠️ Breaking Changes
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
+ ### 🧱 Updated Dependencies
11
+
12
+ - Updated ability-sdk to 2.4.0
13
+ - Updated app-sdk to 2.5.1
14
+ - Updated e2e-test-utils to 2.0.0
15
+
16
+ ### ❤️ Thank You
17
+
18
+ - awisniew207 @awisniew207
@@ -0,0 +1,82 @@
1
+ # Contributing to Vincent Ability relay-link
2
+
3
+ This document provides guidelines for contributing to the Vincent Ability relay-link project.
4
+
5
+ ## Overview
6
+
7
+ The Vincent Ability relay-link is an ability to perform swap and bridge operations via Relay.link from a Vincent app on behalf of the delegator. It's part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK.
8
+
9
+ ## Setup
10
+
11
+ 1. Follow the global setup instructions in the repository root [CONTRIBUTING.md](../../../CONTRIBUTING.md).
12
+ 2. Install dependencies:
13
+ ```bash
14
+ pnpm install
15
+ ```
16
+
17
+ ## Development Workflow
18
+
19
+ ### Testing
20
+
21
+ Run tests:
22
+
23
+ ```bash
24
+ nx test ability-relay-link
25
+ ```
26
+
27
+ ### Building the Lit Action
28
+
29
+ Build the ability:
30
+
31
+ ```bash
32
+ nx action:build ability-relay-link
33
+ ```
34
+
35
+ ### Deploying the Lit Action to IPFS
36
+
37
+ Building will be done automatically. Deploy the ability:
38
+
39
+ ```bash
40
+ nx action:deploy ability-relay-link
41
+ ```
42
+
43
+ ## Project Structure
44
+
45
+ - `src/`: Source code
46
+ - `index.ts`: Main entry point
47
+
48
+ ## Ability Development Guidelines
49
+
50
+ 1. Use the Vincent Ability SDK to create abilities
51
+ 2. Define clear schemas for ability parameters
52
+ 3. Implement the ability lifecycle methods (precheck, execute)
53
+ 4. Handle errors gracefully
54
+ 5. Write comprehensive tests for all functionality
55
+ 6. Document the ability's purpose and usage
56
+
57
+ ## Testing
58
+
59
+ Write unit tests for all functionality:
60
+
61
+ ```bash
62
+ pnpm test
63
+ ```
64
+
65
+ ## Documentation
66
+
67
+ - Document the ability's purpose and usage
68
+ - Update README.md when adding new features
69
+ - Document the ability's parameters and behavior
70
+
71
+ ## Pull Request Process
72
+
73
+ 1. Ensure your code follows the coding standards
74
+ 2. Update documentation if necessary
75
+ 3. Include tests for new functionality
76
+ 4. Link any related issues in your pull request description
77
+ 5. Request a review from a maintainer
78
+
79
+ ## Additional Resources
80
+
81
+ - [Vincent Documentation](https://docs.heyvincent.ai/)
82
+ - [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # Vincent Relay.link Gated Signer Ability
2
+
3
+ A Vincent Ability that acts as a secure, gated signer for [Relay.link](https://relay.link) swap operations. It is designed to work with ERC-4337 Smart Accounts (UserOperations) and EOAs (Transactions).
4
+
5
+ ## Overview
6
+
7
+ This ability validates transactions or UserOperations destined for the Relay.link protocol. It ensures that swap operations are safe and aligned with the user's intent before signing them with the delegated Vincent PKP.
8
+
9
+ It uses the `createVincentGatedSignerAbility` from `@lit-protocol/vincent-ability-sdk/gatedSigner` to enforce a strict validation lifecycle:
10
+
11
+ 1. **Decode**: Decodes the transaction or userOperation calldata.
12
+ 2. **Simulation**: Simulates the transaction/userOperation on-chain via Alchemy.
13
+ 3. **Validation**:
14
+ - Verifies interaction with authorized Relay.link contracts.
15
+ - Checks for value extraction (no unexpected transfers or approvals).
16
+ - Validates that ERC20 approvals only go to Relay.link contracts.
17
+ 4. **Signing**: Signs the UserOperation (ECDSA or EIP-712) or Transaction (ECDSA) if all checks pass.
18
+
19
+ ## Features
20
+
21
+ - **Smart Account Support**: Compatible with ZeroDev, Crossmint, Safe, and other ERC-4337 accounts.
22
+ - **EOA Support**: Can sign raw transactions for EOAs.
23
+ - **Protocol Safety**: Restricts interactions to Relay.link contracts.
24
+ - **Simulation-based Security**: Validates the actual on-chain effects of the transaction.
25
+ - **Helper Functions**: Includes utilities for building and submitting UserOps for each smart account provider.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pnpm add @lit-protocol/vincent-ability-relay-link
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Getting a Relay.link Quote
36
+
37
+ ```typescript
38
+ import { getRelayLinkQuote } from '@lit-protocol/vincent-ability-relay-link';
39
+
40
+ const quote = await getRelayLinkQuote({
41
+ user: '0x...', // Smart account or EOA address
42
+ originChainId: 8453, // Base
43
+ destinationChainId: 8453,
44
+ originCurrency: '0x0000000000000000000000000000000000000000', // ETH
45
+ destinationCurrency: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
46
+ amount: '10000000000000', // Amount in wei
47
+ tradeType: 'EXACT_INPUT',
48
+ });
49
+ ```
50
+
51
+ ### Smart Account Helpers
52
+
53
+ The package exports helper functions for each supported smart account provider:
54
+
55
+ #### ZeroDev
56
+
57
+ ```typescript
58
+ import {
59
+ relayTransactionToUserOp,
60
+ submitSignedUserOp,
61
+ } from '@lit-protocol/vincent-ability-relay-link';
62
+
63
+ // Build UserOp from relay transaction
64
+ const userOp = await relayTransactionToUserOp({
65
+ permittedAddress: pkpAddress,
66
+ serializedPermissionAccount: '...',
67
+ transaction: txData,
68
+ chain: base,
69
+ zerodevRpcUrl: ZERODEV_RPC_URL,
70
+ });
71
+
72
+ // After signing with the ability, submit the UserOp
73
+ const { transactionHash } = await submitSignedUserOp({
74
+ permittedAddress: pkpAddress,
75
+ serializedPermissionAccount: '...',
76
+ userOpSignature: signature,
77
+ userOp,
78
+ chain: base,
79
+ zerodevRpcUrl: ZERODEV_RPC_URL,
80
+ });
81
+ ```
82
+
83
+ #### Crossmint
84
+
85
+ ```typescript
86
+ import {
87
+ transactionsToCrossmintUserOp,
88
+ sendPermittedCrossmintUserOperation,
89
+ } from '@lit-protocol/vincent-ability-relay-link';
90
+
91
+ // Build UserOp (supports batching multiple transactions)
92
+ const crossmintUserOp = await transactionsToCrossmintUserOp({
93
+ crossmintClient,
94
+ crossmintAccountAddress: smartAccountAddress,
95
+ permittedAddress: pkpAddress,
96
+ transactions: [{ to, data, value }],
97
+ chain: base,
98
+ });
99
+
100
+ // After signing with the ability, submit the UserOp
101
+ const userOpHash = await sendPermittedCrossmintUserOperation({
102
+ crossmintClient,
103
+ accountAddress: smartAccountAddress,
104
+ signature,
105
+ signerAddress: pkpAddress,
106
+ userOp: crossmintUserOp,
107
+ });
108
+ ```
109
+
110
+ #### Safe
111
+
112
+ ```typescript
113
+ import {
114
+ transactionsToSafeUserOp,
115
+ sendPermittedSafeUserOperation,
116
+ formatSafeSignature,
117
+ safeEip712Params,
118
+ } from '@lit-protocol/vincent-ability-relay-link';
119
+
120
+ // Build UserOp (supports batching multiple transactions)
121
+ const safeUserOp = await transactionsToSafeUserOp({
122
+ safeAddress: smartAccountAddress,
123
+ permittedAddress: pkpAddress,
124
+ transactions: [{ to, data, value }],
125
+ chain: base,
126
+ safeRpcUrl: SAFE_RPC_URL,
127
+ pimlicoRpcUrl: PIMLICO_RPC_URL,
128
+ });
129
+
130
+ // After signing with the ability, format and submit
131
+ const formattedSignature = formatSafeSignature({
132
+ validAfter: 0,
133
+ validUntil: 0,
134
+ signature,
135
+ });
136
+
137
+ const txHash = await sendPermittedSafeUserOperation({
138
+ signedUserOp: { ...safeUserOp, signature: formattedSignature },
139
+ chain: base,
140
+ pimlicoRpcUrl: PIMLICO_RPC_URL,
141
+ });
142
+ ```
143
+
144
+ ### Ability Parameters
145
+
146
+ #### For UserOperations (Smart Accounts)
147
+
148
+ ```typescript
149
+ const abilityParams = {
150
+ alchemyRpcUrl: 'https://...', // Required for simulation
151
+ entryPointAddress: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
152
+ userOp: vincentUserOp,
153
+ // Optional parameters for Safe/EIP-712
154
+ safe4337ModuleAddress: '0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226',
155
+ eip712Params: safeEip712Params,
156
+ validAfter: 0,
157
+ validUntil: 0,
158
+ };
159
+ ```
160
+
161
+ #### For Transactions (EOA)
162
+
163
+ ```typescript
164
+ const abilityParams = {
165
+ alchemyRpcUrl: 'https://...', // Required for simulation
166
+ transaction: {
167
+ to: '0x...',
168
+ data: '0x...',
169
+ value: '0x...',
170
+ from: '0x...',
171
+ // ... other tx fields
172
+ },
173
+ };
174
+ ```
175
+
176
+ ## Development
177
+
178
+ ### Building
179
+
180
+ ```bash
181
+ pnpm nx build ability-relay-link
182
+ ```
183
+
184
+ ### Unit Tests
185
+
186
+ ```bash
187
+ pnpm nx test ability-relay-link
188
+ ```
189
+
190
+ ### E2E Tests
191
+
192
+ ```bash
193
+ # Run EOA tests
194
+ pnpm nx run ability-relay-link:test-e2e
195
+
196
+ # Run all smart account tests
197
+ pnpm nx run ability-relay-link:test-e2e-smart-account
198
+
199
+ # Run specific provider tests
200
+ pnpm nx run ability-relay-link:test-e2e-smart-account:zerodev
201
+ pnpm nx run ability-relay-link:test-e2e-smart-account:crossmint
202
+ pnpm nx run ability-relay-link:test-e2e-smart-account:safe
203
+ ```
204
+
205
+ ### Required Environment Variables
206
+
207
+ For E2E tests, set the following in your `.env` file:
208
+
209
+ ```bash
210
+ # Required for all tests
211
+ ALCHEMY_RPC_URL=https://base-mainnet.g.alchemy.com/v2/...
212
+
213
+ # ZeroDev
214
+ ZERODEV_RPC_URL=https://rpc.zerodev.app/api/v3/.../chain/8453
215
+ SMART_ACCOUNT_CHAIN_ID=8453
216
+
217
+ # Crossmint
218
+ CROSSMINT_API_KEY=...
219
+
220
+ # Safe
221
+ SAFE_RPC_URL=https://base-mainnet.g.alchemy.com/v2/...
222
+ PIMLICO_RPC_URL=https://api.pimlico.io/v2/8453/rpc?apikey=...
223
+ ```
File without changes
@@ -0,0 +1,82 @@
1
+ # Contributing to Vincent Ability relay-link
2
+
3
+ This document provides guidelines for contributing to the Vincent Ability relay-link project.
4
+
5
+ ## Overview
6
+
7
+ The Vincent Ability relay-link is an ability to perform swap and bridge operations via Relay.link from a Vincent app on behalf of the delegator. It's part of the Vincent Abilities ecosystem and is built using the Vincent Ability SDK.
8
+
9
+ ## Setup
10
+
11
+ 1. Follow the global setup instructions in the repository root [CONTRIBUTING.md](../../../CONTRIBUTING.md).
12
+ 2. Install dependencies:
13
+ ```bash
14
+ pnpm install
15
+ ```
16
+
17
+ ## Development Workflow
18
+
19
+ ### Testing
20
+
21
+ Run tests:
22
+
23
+ ```bash
24
+ nx test ability-relay-link
25
+ ```
26
+
27
+ ### Building the Lit Action
28
+
29
+ Build the ability:
30
+
31
+ ```bash
32
+ nx action:build ability-relay-link
33
+ ```
34
+
35
+ ### Deploying the Lit Action to IPFS
36
+
37
+ Building will be done automatically. Deploy the ability:
38
+
39
+ ```bash
40
+ nx action:deploy ability-relay-link
41
+ ```
42
+
43
+ ## Project Structure
44
+
45
+ - `src/`: Source code
46
+ - `index.ts`: Main entry point
47
+
48
+ ## Ability Development Guidelines
49
+
50
+ 1. Use the Vincent Ability SDK to create abilities
51
+ 2. Define clear schemas for ability parameters
52
+ 3. Implement the ability lifecycle methods (precheck, execute)
53
+ 4. Handle errors gracefully
54
+ 5. Write comprehensive tests for all functionality
55
+ 6. Document the ability's purpose and usage
56
+
57
+ ## Testing
58
+
59
+ Write unit tests for all functionality:
60
+
61
+ ```bash
62
+ pnpm test
63
+ ```
64
+
65
+ ## Documentation
66
+
67
+ - Document the ability's purpose and usage
68
+ - Update README.md when adding new features
69
+ - Document the ability's parameters and behavior
70
+
71
+ ## Pull Request Process
72
+
73
+ 1. Ensure your code follows the coding standards
74
+ 2. Update documentation if necessary
75
+ 3. Include tests for new functionality
76
+ 4. Link any related issues in your pull request description
77
+ 5. Request a review from a maintainer
78
+
79
+ ## Additional Resources
80
+
81
+ - [Vincent Documentation](https://docs.heyvincent.ai/)
82
+ - [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
package/dist/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # Vincent Relay.link Gated Signer Ability
2
+
3
+ A Vincent Ability that acts as a secure, gated signer for [Relay.link](https://relay.link) swap operations. It is designed to work with ERC-4337 Smart Accounts (UserOperations) and EOAs (Transactions).
4
+
5
+ ## Overview
6
+
7
+ This ability validates transactions or UserOperations destined for the Relay.link protocol. It ensures that swap operations are safe and aligned with the user's intent before signing them with the delegated Vincent PKP.
8
+
9
+ It uses the `createVincentGatedSignerAbility` from `@lit-protocol/vincent-ability-sdk/gatedSigner` to enforce a strict validation lifecycle:
10
+
11
+ 1. **Decode**: Decodes the transaction or userOperation calldata.
12
+ 2. **Simulation**: Simulates the transaction/userOperation on-chain via Alchemy.
13
+ 3. **Validation**:
14
+ - Verifies interaction with authorized Relay.link contracts.
15
+ - Checks for value extraction (no unexpected transfers or approvals).
16
+ - Validates that ERC20 approvals only go to Relay.link contracts.
17
+ 4. **Signing**: Signs the UserOperation (ECDSA or EIP-712) or Transaction (ECDSA) if all checks pass.
18
+
19
+ ## Features
20
+
21
+ - **Smart Account Support**: Compatible with ZeroDev, Crossmint, Safe, and other ERC-4337 accounts.
22
+ - **EOA Support**: Can sign raw transactions for EOAs.
23
+ - **Protocol Safety**: Restricts interactions to Relay.link contracts.
24
+ - **Simulation-based Security**: Validates the actual on-chain effects of the transaction.
25
+ - **Helper Functions**: Includes utilities for building and submitting UserOps for each smart account provider.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pnpm add @lit-protocol/vincent-ability-relay-link
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ ### Getting a Relay.link Quote
36
+
37
+ ```typescript
38
+ import { getRelayLinkQuote } from '@lit-protocol/vincent-ability-relay-link';
39
+
40
+ const quote = await getRelayLinkQuote({
41
+ user: '0x...', // Smart account or EOA address
42
+ originChainId: 8453, // Base
43
+ destinationChainId: 8453,
44
+ originCurrency: '0x0000000000000000000000000000000000000000', // ETH
45
+ destinationCurrency: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
46
+ amount: '10000000000000', // Amount in wei
47
+ tradeType: 'EXACT_INPUT',
48
+ });
49
+ ```
50
+
51
+ ### Smart Account Helpers
52
+
53
+ The package exports helper functions for each supported smart account provider:
54
+
55
+ #### ZeroDev
56
+
57
+ ```typescript
58
+ import {
59
+ relayTransactionToUserOp,
60
+ submitSignedUserOp,
61
+ } from '@lit-protocol/vincent-ability-relay-link';
62
+
63
+ // Build UserOp from relay transaction
64
+ const userOp = await relayTransactionToUserOp({
65
+ permittedAddress: pkpAddress,
66
+ serializedPermissionAccount: '...',
67
+ transaction: txData,
68
+ chain: base,
69
+ zerodevRpcUrl: ZERODEV_RPC_URL,
70
+ });
71
+
72
+ // After signing with the ability, submit the UserOp
73
+ const { transactionHash } = await submitSignedUserOp({
74
+ permittedAddress: pkpAddress,
75
+ serializedPermissionAccount: '...',
76
+ userOpSignature: signature,
77
+ userOp,
78
+ chain: base,
79
+ zerodevRpcUrl: ZERODEV_RPC_URL,
80
+ });
81
+ ```
82
+
83
+ #### Crossmint
84
+
85
+ ```typescript
86
+ import {
87
+ transactionsToCrossmintUserOp,
88
+ sendPermittedCrossmintUserOperation,
89
+ } from '@lit-protocol/vincent-ability-relay-link';
90
+
91
+ // Build UserOp (supports batching multiple transactions)
92
+ const crossmintUserOp = await transactionsToCrossmintUserOp({
93
+ crossmintClient,
94
+ crossmintAccountAddress: smartAccountAddress,
95
+ permittedAddress: pkpAddress,
96
+ transactions: [{ to, data, value }],
97
+ chain: base,
98
+ });
99
+
100
+ // After signing with the ability, submit the UserOp
101
+ const userOpHash = await sendPermittedCrossmintUserOperation({
102
+ crossmintClient,
103
+ accountAddress: smartAccountAddress,
104
+ signature,
105
+ signerAddress: pkpAddress,
106
+ userOp: crossmintUserOp,
107
+ });
108
+ ```
109
+
110
+ #### Safe
111
+
112
+ ```typescript
113
+ import {
114
+ transactionsToSafeUserOp,
115
+ sendPermittedSafeUserOperation,
116
+ formatSafeSignature,
117
+ safeEip712Params,
118
+ } from '@lit-protocol/vincent-ability-relay-link';
119
+
120
+ // Build UserOp (supports batching multiple transactions)
121
+ const safeUserOp = await transactionsToSafeUserOp({
122
+ safeAddress: smartAccountAddress,
123
+ permittedAddress: pkpAddress,
124
+ transactions: [{ to, data, value }],
125
+ chain: base,
126
+ safeRpcUrl: SAFE_RPC_URL,
127
+ pimlicoRpcUrl: PIMLICO_RPC_URL,
128
+ });
129
+
130
+ // After signing with the ability, format and submit
131
+ const formattedSignature = formatSafeSignature({
132
+ validAfter: 0,
133
+ validUntil: 0,
134
+ signature,
135
+ });
136
+
137
+ const txHash = await sendPermittedSafeUserOperation({
138
+ signedUserOp: { ...safeUserOp, signature: formattedSignature },
139
+ chain: base,
140
+ pimlicoRpcUrl: PIMLICO_RPC_URL,
141
+ });
142
+ ```
143
+
144
+ ### Ability Parameters
145
+
146
+ #### For UserOperations (Smart Accounts)
147
+
148
+ ```typescript
149
+ const abilityParams = {
150
+ alchemyRpcUrl: 'https://...', // Required for simulation
151
+ entryPointAddress: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
152
+ userOp: vincentUserOp,
153
+ // Optional parameters for Safe/EIP-712
154
+ safe4337ModuleAddress: '0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226',
155
+ eip712Params: safeEip712Params,
156
+ validAfter: 0,
157
+ validUntil: 0,
158
+ };
159
+ ```
160
+
161
+ #### For Transactions (EOA)
162
+
163
+ ```typescript
164
+ const abilityParams = {
165
+ alchemyRpcUrl: 'https://...', // Required for simulation
166
+ transaction: {
167
+ to: '0x...',
168
+ data: '0x...',
169
+ value: '0x...',
170
+ from: '0x...',
171
+ // ... other tx fields
172
+ },
173
+ };
174
+ ```
175
+
176
+ ## Development
177
+
178
+ ### Building
179
+
180
+ ```bash
181
+ pnpm nx build ability-relay-link
182
+ ```
183
+
184
+ ### Unit Tests
185
+
186
+ ```bash
187
+ pnpm nx test ability-relay-link
188
+ ```
189
+
190
+ ### E2E Tests
191
+
192
+ ```bash
193
+ # Run EOA tests
194
+ pnpm nx run ability-relay-link:test-e2e
195
+
196
+ # Run all smart account tests
197
+ pnpm nx run ability-relay-link:test-e2e-smart-account
198
+
199
+ # Run specific provider tests
200
+ pnpm nx run ability-relay-link:test-e2e-smart-account:zerodev
201
+ pnpm nx run ability-relay-link:test-e2e-smart-account:crossmint
202
+ pnpm nx run ability-relay-link:test-e2e-smart-account:safe
203
+ ```
204
+
205
+ ### Required Environment Variables
206
+
207
+ For E2E tests, set the following in your `.env` file:
208
+
209
+ ```bash
210
+ # Required for all tests
211
+ ALCHEMY_RPC_URL=https://base-mainnet.g.alchemy.com/v2/...
212
+
213
+ # ZeroDev
214
+ ZERODEV_RPC_URL=https://rpc.zerodev.app/api/v3/.../chain/8453
215
+ SMART_ACCOUNT_CHAIN_ID=8453
216
+
217
+ # Crossmint
218
+ CROSSMINT_API_KEY=...
219
+
220
+ # Safe
221
+ SAFE_RPC_URL=https://base-mainnet.g.alchemy.com/v2/...
222
+ PIMLICO_RPC_URL=https://api.pimlico.io/v2/8453/rpc?apikey=...
223
+ ```
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@lit-protocol/vincent-ability-relay-link",
3
+ "version": "0.0.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "dependencies": {
8
+ "@crossmint/wallets-sdk": "^0.18.1",
9
+ "@lit-protocol/vincent-ability-sdk": "workspace:*",
10
+ "@relayprotocol/relay-sdk": "^4.0.0",
11
+ "@zerodev/permissions": "^5.6.2",
12
+ "@zerodev/sdk": "^5.5.3",
13
+ "permissionless": "^0.3.2",
14
+ "tslib": "2.8.1",
15
+ "viem": "^2.41.2"
16
+ },
17
+ "peerDependencies": {
18
+ "@lit-protocol/vincent-app-sdk": "workspace:^"
19
+ },
20
+ "devDependencies": {
21
+ "@lit-protocol/esbuild-plugin-polyfill-node": "^0.3.0",
22
+ "@lit-protocol/vincent-app-sdk": "workspace:^",
23
+ "@lit-protocol/vincent-e2e-test-utils": "workspace:*",
24
+ "esbuild": "^0.19.12",
25
+ "ethers-v6": "npm:ethers@^6",
26
+ "ipfs-only-hash": "^4.0.0",
27
+ "zod": "^3.23.8"
28
+ },
29
+ "main": "./dist/src/index.js",
30
+ "module": "./dist/src/index.js",
31
+ "types": "./dist/src/index.d.ts",
32
+ "files": [
33
+ "dist/**",
34
+ "*.md"
35
+ ],
36
+ "type": "commonjs"
37
+ }