@lombard.finance/sdk-agentkit 0.1.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/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/index.cjs +3738 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3719 -0
- package/dist/lombardActionProvider.d.ts +44 -0
- package/dist/lombardActionProvider.d.ts.map +1 -0
- package/dist/networks.d.ts +43 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/schemas.d.ts +72 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +74 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Lombard Finance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @lombard.finance/sdk-agentkit
|
|
2
|
+
|
|
3
|
+
[Coinbase AgentKit](https://github.com/coinbase/agentkit) ActionProvider for the [Lombard protocol](https://lombard.finance). Enables AI agents built with AgentKit to stake Bitcoin, mint LBTC, check balances, and deploy to DeFi vaults.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lombard.finance/sdk-agentkit
|
|
9
|
+
# or
|
|
10
|
+
yarn add @lombard.finance/sdk-agentkit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @coinbase/agentkit viem zod
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { lombardActionProvider } from "@lombard.finance/sdk-agentkit";
|
|
23
|
+
import { AgentKit } from "@coinbase/agentkit";
|
|
24
|
+
|
|
25
|
+
const agentkit = await AgentKit.from({
|
|
26
|
+
walletProvider,
|
|
27
|
+
actionProviders: [lombardActionProvider()],
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Agent now has access to all Lombard actions
|
|
31
|
+
const actions = agentkit.getActions();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### With LangChain
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { lombardActionProvider } from "@lombard.finance/sdk-agentkit";
|
|
38
|
+
import { AgentKit } from "@coinbase/agentkit";
|
|
39
|
+
import { getLangChainTools } from "@coinbase/agentkit-langchain";
|
|
40
|
+
import { createReactAgent } from "@langchain/langgraph/prebuilt";
|
|
41
|
+
|
|
42
|
+
const agentkit = await AgentKit.from({
|
|
43
|
+
walletProvider,
|
|
44
|
+
actionProviders: [lombardActionProvider()],
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const tools = getLangChainTools(agentkit);
|
|
48
|
+
const agent = createReactAgent({ llm: yourModel, tools });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Available Actions
|
|
52
|
+
|
|
53
|
+
### Write Actions
|
|
54
|
+
|
|
55
|
+
| Action | Description |
|
|
56
|
+
| ------ | ----------- |
|
|
57
|
+
| `stake_btcb_to_lbtc` | Stake BTC.b to receive LBTC. Handles approval and fee authorization automatically |
|
|
58
|
+
| `unstake_lbtc` | Unstake LBTC to native BTC (cross-chain) or BTC.b (same-chain) |
|
|
59
|
+
| `redeem_lbtc_to_btcb` | Simple same-chain LBTC to BTC.b conversion |
|
|
60
|
+
| `deploy_to_defi` | Deploy LBTC into a DeFi vault (Bitcoin Earn) for additional yield |
|
|
61
|
+
| `claim_deposit` | Claim a notarized BTC deposit to mint LBTC |
|
|
62
|
+
|
|
63
|
+
### Read Actions
|
|
64
|
+
|
|
65
|
+
| Action | Description |
|
|
66
|
+
| ------ | ----------- |
|
|
67
|
+
| `get_lbtc_balance` | Check LBTC balance for any address on the current chain |
|
|
68
|
+
| `get_btcb_balance` | Check BTC.b balance for any address on the current chain |
|
|
69
|
+
| `get_lbtc_exchange_rate` | Current LBTC/BTC exchange rate and minimum stake amount |
|
|
70
|
+
| `get_deposit_status` | Track all deposits (pending, claimable, claimed, failed) |
|
|
71
|
+
| `get_unstake_status` | Track all unstake and redemption operations |
|
|
72
|
+
|
|
73
|
+
## Supported Networks
|
|
74
|
+
|
|
75
|
+
| AgentKit Network ID | Chain | Environment |
|
|
76
|
+
| ------------------- | ----- | ----------- |
|
|
77
|
+
| `ethereum-mainnet` | Ethereum | Production |
|
|
78
|
+
| `ethereum-sepolia` | Ethereum Sepolia | Testnet |
|
|
79
|
+
| `base-mainnet` | Base | Production |
|
|
80
|
+
| `base-sepolia` | Base Sepolia | Testnet |
|
|
81
|
+
|
|
82
|
+
Network aliases are also accepted: `ethereum`, `eth`, `mainnet`, `sepolia`, `base`, `base-sep`.
|
|
83
|
+
|
|
84
|
+
## How It Works
|
|
85
|
+
|
|
86
|
+
The `LombardActionProvider` bridges Coinbase AgentKit and the Lombard SDK:
|
|
87
|
+
|
|
88
|
+
1. **Network mapping**: Translates AgentKit network IDs to Lombard chain configuration
|
|
89
|
+
2. **Wallet adaptation**: Converts AgentKit's wallet provider to EIP-1193 for the Lombard SDK
|
|
90
|
+
3. **Automatic approvals**: Checks and sets token allowances before transactions
|
|
91
|
+
4. **Fee authorization**: Handles EIP-712 fee signatures on chains that require them (Ethereum, Sepolia)
|
|
92
|
+
5. **Error sanitization**: Strips RPC URLs and sensitive data from error messages
|
|
93
|
+
|
|
94
|
+
All write actions execute real on-chain transactions through the AgentKit wallet.
|
|
95
|
+
|
|
96
|
+
## Utilities
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import {
|
|
100
|
+
resolveNetwork,
|
|
101
|
+
resolveChainName,
|
|
102
|
+
isLombardSupportedNetwork,
|
|
103
|
+
} from "@lombard.finance/sdk-agentkit";
|
|
104
|
+
|
|
105
|
+
// Check if a network is supported
|
|
106
|
+
isLombardSupportedNetwork(network); // boolean
|
|
107
|
+
|
|
108
|
+
// Resolve AgentKit network to Lombard config
|
|
109
|
+
const resolved = resolveNetwork(network);
|
|
110
|
+
// { chainId, env, networkId }
|
|
111
|
+
|
|
112
|
+
// Resolve by friendly name
|
|
113
|
+
const resolved = resolveChainName("ethereum");
|
|
114
|
+
// { chainId: 1, env: "prod", networkId: "ethereum-mainnet" }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Requirements
|
|
118
|
+
|
|
119
|
+
- **Node.js**: 18+
|
|
120
|
+
- **@coinbase/agentkit**: 0.2+
|
|
121
|
+
- **viem**: 2.21+
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|