@lit-protocol/vincent-ability-debridge 0.0.7-mma

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 (33) hide show
  1. package/CONTRIBUTING.md +90 -0
  2. package/README.md +124 -0
  3. package/dist/CONTRIBUTING.md +90 -0
  4. package/dist/README.md +124 -0
  5. package/dist/package.json +35 -0
  6. package/dist/src/generated/lit-action.js +9 -0
  7. package/dist/src/generated/vincent-ability-metadata.json +3 -0
  8. package/dist/src/generated/vincent-bundled-ability.d.ts +191 -0
  9. package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
  10. package/dist/src/generated/vincent-bundled-ability.js +15 -0
  11. package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
  12. package/dist/src/generated/vincent-bundled-ability.ts +13 -0
  13. package/dist/src/index.d.ts +2 -0
  14. package/dist/src/index.d.ts.map +1 -0
  15. package/dist/src/index.js +6 -0
  16. package/dist/src/index.js.map +1 -0
  17. package/dist/src/lib/helpers/index.d.ts +67 -0
  18. package/dist/src/lib/helpers/index.d.ts.map +1 -0
  19. package/dist/src/lib/helpers/index.js +241 -0
  20. package/dist/src/lib/helpers/index.js.map +1 -0
  21. package/dist/src/lib/lit-action.d.ts +2 -0
  22. package/dist/src/lib/lit-action.d.ts.map +1 -0
  23. package/dist/src/lib/lit-action.js +16 -0
  24. package/dist/src/lib/lit-action.js.map +1 -0
  25. package/dist/src/lib/schemas.d.ts +198 -0
  26. package/dist/src/lib/schemas.d.ts.map +1 -0
  27. package/dist/src/lib/schemas.js +93 -0
  28. package/dist/src/lib/schemas.js.map +1 -0
  29. package/dist/src/lib/vincent-ability.d.ts +188 -0
  30. package/dist/src/lib/vincent-ability.d.ts.map +1 -0
  31. package/dist/src/lib/vincent-ability.js +258 -0
  32. package/dist/src/lib/vincent-ability.js.map +1 -0
  33. package/package.json +34 -0
@@ -0,0 +1,90 @@
1
+ # Contributing to Vincent Ability Debridge
2
+
3
+ This document provides guidelines for contributing to the Vincent Ability Debridge project.
4
+
5
+ ## Overview
6
+
7
+ The Vincent Ability Debridge is a ability to send deposit, withdraw or redeem Debridge transactions 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-debridge
25
+ ```
26
+
27
+ ### Building the Lit Action
28
+
29
+ Build the ability:
30
+
31
+ ```bash
32
+ nx action:build ability-debridge
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-erc20-approval
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 abilitys
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
+ ## Integration with Policies
58
+
59
+ This ability can be integrated with various Vincent Policies to enforce constraints. When developing or modifying the ability, consider how it will be used with policies such as:
60
+
61
+ - Vincent Policy Spending Limit
62
+
63
+ ## Testing
64
+
65
+ Write unit tests for all functionality:
66
+
67
+ ```bash
68
+ pnpm test
69
+ ```
70
+
71
+ ## Documentation
72
+
73
+ - Document the ability's purpose and usage
74
+ - Update README.md when adding new features
75
+ - Document the ability's parameters and behavior
76
+
77
+ ## Pull Request Process
78
+
79
+ 1. Ensure your code follows the coding standards
80
+ 2. Update documentation if necessary
81
+ 3. Include tests for new functionality
82
+ 4. Link any related issues in your pull request description
83
+ 5. Request a review from a maintainer
84
+
85
+ ## Additional Resources
86
+
87
+ - [Vincent Documentation](https://docs.heyvincent.ai/)
88
+ - [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
89
+ - [ERC20 Standard](https://eips.ethereum.org/EIPS/eip-20)
90
+ - [ERC4626 Standard](https://eips.ethereum.org/EIPS/eip-4626)
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # Vincent Ability deBridge
2
+
3
+ Bridge tokens across multiple blockchains using the deBridge protocol. Supports native tokens and
4
+ ERC-20 tokens with automatic quote fetching and gas estimation.
5
+
6
+ ## Features
7
+
8
+ - Cross-chain transfers between multiple EVM-compatible chains
9
+ - Support for both native tokens (ETH, MATIC, etc.) and ERC-20 tokens
10
+ - Automatic quote fetching from deBridge API
11
+ - Gas estimation and fee calculation
12
+ - Integrated with Vincent Ability SDK for secure execution
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @lit-protocol/vincent-ability-debridge
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk';
24
+ import { bundledVincentAbility as deBridgeAbility } from '@lit-protocol/vincent-ability-debridge';
25
+ import { ethers } from 'ethers';
26
+
27
+ // Initialize the ability client
28
+ const deBridgeClient = getVincentAbilityClient({
29
+ bundledVincentAbility: deBridgeAbility,
30
+ ethersSigner: yourSigner, // Your ethers signer
31
+ });
32
+
33
+ // Example: Bridge 0.1 ETH from Base to Arbitrum
34
+ const bridgeParams = {
35
+ rpcUrl: 'https://base-mainnet.g.alchemy.com/v2/YOUR_KEY',
36
+ sourceChain: '8453', // Base
37
+ destinationChain: '42161', // Arbitrum
38
+ sourceToken: '0x0000000000000000000000000000000000000000', // Native ETH
39
+ destinationToken: '0x0000000000000000000000000000000000000000', // Native ETH
40
+ amount: ethers.utils.parseEther('0.1').toString(), // 0.1 ETH in wei
41
+ recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD7e',
42
+ operation: 'BRIDGE',
43
+ slippageBps: 100, // 1% slippage
44
+ };
45
+
46
+ // First run precheck
47
+ const precheckRes = await deBridgeClient.precheck(bridgeParams, {
48
+ delegatorPkpEthAddress: pkpAddress,
49
+ });
50
+
51
+ if (precheckRes.success) {
52
+ // Then execute
53
+ const executeRes = await deBridgeClient.execute(bridgeParams, {
54
+ delegatorPkpEthAddress: pkpAddress,
55
+ });
56
+
57
+ if (executeRes.success) {
58
+ console.log('Transaction hash:', executeRes.result.data.txHash);
59
+ console.log('Order ID:', executeRes.result.data.orderId);
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## Supported Chains
65
+
66
+ - Ethereum (1)
67
+ - Polygon (137)
68
+ - Arbitrum (42161)
69
+ - Optimism (10)
70
+ - Base (8453)
71
+ - BSC (56)
72
+ - Avalanche (43114)
73
+
74
+ ## Parameters
75
+
76
+ | Parameter | Type | Required | Description |
77
+ | ------------------ | -------- | -------- | -------------------------------------------------------------------------- |
78
+ | `rpcUrl` | `string` | ✅ | RPC URL for the source chain |
79
+ | `sourceChain` | `string` | ✅ | Source chain ID (e.g., '1' for Ethereum, '8453' for Base) |
80
+ | `destinationChain` | `string` | ✅ | Destination chain ID |
81
+ | `sourceToken` | `string` | ✅ | Source token address (use zero address for native token) |
82
+ | `destinationToken` | `string` | ✅ | Destination token address (use zero address for native token) |
83
+ | `amount` | `string` | ✅ | Amount in base units (wei for ETH, smallest unit for tokens) |
84
+ | `recipientAddress` | `string` | ✅ | Recipient address on destination chain |
85
+ | `operation` | `string` | ✅ | `BRIDGE` for direct transfers, `BRIDGE_AND_SWAP` for cross-asset transfers |
86
+ | `slippageBps` | `number` | ❌ | Slippage tolerance in basis points (default: 100 = 1%) |
87
+
88
+ ⚠️ **Important**: The `amount` parameter must be in the token's smallest unit (e.g., wei for ETH).
89
+
90
+ ## Prerequisites
91
+
92
+ - Node.js 16+ and npm/yarn
93
+ - Sufficient token balance for the bridge amount + fees
94
+ - Properly configured PKP wallet with required permissions
95
+ - For ERC-20 tokens: Sufficient token allowance for the deBridge contract
96
+
97
+ ## Building
98
+
99
+ ```bash
100
+ # Build the ability
101
+ npm run build
102
+
103
+ # Build all abilitys and policies
104
+ npm run vincent:build
105
+ ```
106
+
107
+ ## Testing
108
+
109
+ ```bash
110
+ # Run unit tests
111
+ npm test
112
+
113
+ # Run E2E tests
114
+ npm run test:e2e
115
+ ```
116
+
117
+ ## Contributing
118
+
119
+ Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
120
+ to contribute to this project.
121
+
122
+ ## License
123
+
124
+ This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
@@ -0,0 +1,90 @@
1
+ # Contributing to Vincent Ability Debridge
2
+
3
+ This document provides guidelines for contributing to the Vincent Ability Debridge project.
4
+
5
+ ## Overview
6
+
7
+ The Vincent Ability Debridge is a ability to send deposit, withdraw or redeem Debridge transactions 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-debridge
25
+ ```
26
+
27
+ ### Building the Lit Action
28
+
29
+ Build the ability:
30
+
31
+ ```bash
32
+ nx action:build ability-debridge
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-erc20-approval
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 abilitys
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
+ ## Integration with Policies
58
+
59
+ This ability can be integrated with various Vincent Policies to enforce constraints. When developing or modifying the ability, consider how it will be used with policies such as:
60
+
61
+ - Vincent Policy Spending Limit
62
+
63
+ ## Testing
64
+
65
+ Write unit tests for all functionality:
66
+
67
+ ```bash
68
+ pnpm test
69
+ ```
70
+
71
+ ## Documentation
72
+
73
+ - Document the ability's purpose and usage
74
+ - Update README.md when adding new features
75
+ - Document the ability's parameters and behavior
76
+
77
+ ## Pull Request Process
78
+
79
+ 1. Ensure your code follows the coding standards
80
+ 2. Update documentation if necessary
81
+ 3. Include tests for new functionality
82
+ 4. Link any related issues in your pull request description
83
+ 5. Request a review from a maintainer
84
+
85
+ ## Additional Resources
86
+
87
+ - [Vincent Documentation](https://docs.heyvincent.ai/)
88
+ - [Vincent Ability SDK Documentation](../../libs/ability-sdk/README.md)
89
+ - [ERC20 Standard](https://eips.ethereum.org/EIPS/eip-20)
90
+ - [ERC4626 Standard](https://eips.ethereum.org/EIPS/eip-4626)
package/dist/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # Vincent Ability deBridge
2
+
3
+ Bridge tokens across multiple blockchains using the deBridge protocol. Supports native tokens and
4
+ ERC-20 tokens with automatic quote fetching and gas estimation.
5
+
6
+ ## Features
7
+
8
+ - Cross-chain transfers between multiple EVM-compatible chains
9
+ - Support for both native tokens (ETH, MATIC, etc.) and ERC-20 tokens
10
+ - Automatic quote fetching from deBridge API
11
+ - Gas estimation and fee calculation
12
+ - Integrated with Vincent Ability SDK for secure execution
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @lit-protocol/vincent-ability-debridge
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```typescript
23
+ import { getVincentAbilityClient } from '@lit-protocol/vincent-app-sdk';
24
+ import { bundledVincentAbility as deBridgeAbility } from '@lit-protocol/vincent-ability-debridge';
25
+ import { ethers } from 'ethers';
26
+
27
+ // Initialize the ability client
28
+ const deBridgeClient = getVincentAbilityClient({
29
+ bundledVincentAbility: deBridgeAbility,
30
+ ethersSigner: yourSigner, // Your ethers signer
31
+ });
32
+
33
+ // Example: Bridge 0.1 ETH from Base to Arbitrum
34
+ const bridgeParams = {
35
+ rpcUrl: 'https://base-mainnet.g.alchemy.com/v2/YOUR_KEY',
36
+ sourceChain: '8453', // Base
37
+ destinationChain: '42161', // Arbitrum
38
+ sourceToken: '0x0000000000000000000000000000000000000000', // Native ETH
39
+ destinationToken: '0x0000000000000000000000000000000000000000', // Native ETH
40
+ amount: ethers.utils.parseEther('0.1').toString(), // 0.1 ETH in wei
41
+ recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD7e',
42
+ operation: 'BRIDGE',
43
+ slippageBps: 100, // 1% slippage
44
+ };
45
+
46
+ // First run precheck
47
+ const precheckRes = await deBridgeClient.precheck(bridgeParams, {
48
+ delegatorPkpEthAddress: pkpAddress,
49
+ });
50
+
51
+ if (precheckRes.success) {
52
+ // Then execute
53
+ const executeRes = await deBridgeClient.execute(bridgeParams, {
54
+ delegatorPkpEthAddress: pkpAddress,
55
+ });
56
+
57
+ if (executeRes.success) {
58
+ console.log('Transaction hash:', executeRes.result.data.txHash);
59
+ console.log('Order ID:', executeRes.result.data.orderId);
60
+ }
61
+ }
62
+ ```
63
+
64
+ ## Supported Chains
65
+
66
+ - Ethereum (1)
67
+ - Polygon (137)
68
+ - Arbitrum (42161)
69
+ - Optimism (10)
70
+ - Base (8453)
71
+ - BSC (56)
72
+ - Avalanche (43114)
73
+
74
+ ## Parameters
75
+
76
+ | Parameter | Type | Required | Description |
77
+ | ------------------ | -------- | -------- | -------------------------------------------------------------------------- |
78
+ | `rpcUrl` | `string` | ✅ | RPC URL for the source chain |
79
+ | `sourceChain` | `string` | ✅ | Source chain ID (e.g., '1' for Ethereum, '8453' for Base) |
80
+ | `destinationChain` | `string` | ✅ | Destination chain ID |
81
+ | `sourceToken` | `string` | ✅ | Source token address (use zero address for native token) |
82
+ | `destinationToken` | `string` | ✅ | Destination token address (use zero address for native token) |
83
+ | `amount` | `string` | ✅ | Amount in base units (wei for ETH, smallest unit for tokens) |
84
+ | `recipientAddress` | `string` | ✅ | Recipient address on destination chain |
85
+ | `operation` | `string` | ✅ | `BRIDGE` for direct transfers, `BRIDGE_AND_SWAP` for cross-asset transfers |
86
+ | `slippageBps` | `number` | ❌ | Slippage tolerance in basis points (default: 100 = 1%) |
87
+
88
+ ⚠️ **Important**: The `amount` parameter must be in the token's smallest unit (e.g., wei for ETH).
89
+
90
+ ## Prerequisites
91
+
92
+ - Node.js 16+ and npm/yarn
93
+ - Sufficient token balance for the bridge amount + fees
94
+ - Properly configured PKP wallet with required permissions
95
+ - For ERC-20 tokens: Sufficient token allowance for the deBridge contract
96
+
97
+ ## Building
98
+
99
+ ```bash
100
+ # Build the ability
101
+ npm run build
102
+
103
+ # Build all abilitys and policies
104
+ npm run vincent:build
105
+ ```
106
+
107
+ ## Testing
108
+
109
+ ```bash
110
+ # Run unit tests
111
+ npm test
112
+
113
+ # Run E2E tests
114
+ npm run test:e2e
115
+ ```
116
+
117
+ ## Contributing
118
+
119
+ Contributions are welcome! Please see [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines on how
120
+ to contribute to this project.
121
+
122
+ ## License
123
+
124
+ This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@lit-protocol/vincent-ability-debridge",
3
+ "version": "0.0.6",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "scripts": {
8
+ "vault-search": "tsx examples/vault-search.ts"
9
+ },
10
+ "dependencies": {
11
+ "@lit-protocol/constants": "^7.2.0",
12
+ "@lit-protocol/vincent-scaffold-sdk": "^1.1.6",
13
+ "@lit-protocol/vincent-ability-sdk": "workspace:*",
14
+ "ethers": "^5.8.0",
15
+ "tslib": "2.8.1",
16
+ "zod": "^3.25.64"
17
+ },
18
+ "peerDependencies": {
19
+ "@lit-protocol/vincent-app-sdk": "workspace:^"
20
+ },
21
+ "devDependencies": {
22
+ "esbuild": "^0.19.12",
23
+ "esbuild-plugin-polyfill-node": "^0.3.0",
24
+ "ipfs-only-hash": "^4.0.0",
25
+ "tsx": "^4.19.4"
26
+ },
27
+ "main": "./dist/src/index.js",
28
+ "module": "./dist/src/index.js",
29
+ "types": "./dist/src/index.d.ts",
30
+ "files": [
31
+ "dist/**",
32
+ "*.md"
33
+ ],
34
+ "type": "commonjs"
35
+ }