@arkade-os/skill 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/README.md +116 -0
- package/SKILL.md +269 -0
- package/cli/arkade.mjs +1018 -0
- package/dist/cjs/index.js +88 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/skills/arkadeBitcoin.js +359 -0
- package/dist/cjs/skills/arkadeBitcoin.js.map +1 -0
- package/dist/cjs/skills/index.js +78 -0
- package/dist/cjs/skills/index.js.map +1 -0
- package/dist/cjs/skills/lendaswap.js +458 -0
- package/dist/cjs/skills/lendaswap.js.map +1 -0
- package/dist/cjs/skills/lightning.js +287 -0
- package/dist/cjs/skills/lightning.js.map +1 -0
- package/dist/cjs/skills/types.js +11 -0
- package/dist/cjs/skills/types.js.map +1 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/skills/arkadeBitcoin.js +354 -0
- package/dist/esm/skills/arkadeBitcoin.js.map +1 -0
- package/dist/esm/skills/index.js +69 -0
- package/dist/esm/skills/index.js.map +1 -0
- package/dist/esm/skills/lendaswap.js +453 -0
- package/dist/esm/skills/lendaswap.js.map +1 -0
- package/dist/esm/skills/lightning.js +282 -0
- package/dist/esm/skills/lightning.js.map +1 -0
- package/dist/esm/skills/types.js +10 -0
- package/dist/esm/skills/types.js.map +1 -0
- package/dist/types/index.d.ts +72 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/skills/arkadeBitcoin.d.ts +218 -0
- package/dist/types/skills/arkadeBitcoin.d.ts.map +1 -0
- package/dist/types/skills/index.d.ts +67 -0
- package/dist/types/skills/index.d.ts.map +1 -0
- package/dist/types/skills/lendaswap.d.ts +152 -0
- package/dist/types/skills/lendaswap.d.ts.map +1 -0
- package/dist/types/skills/lightning.d.ts +181 -0
- package/dist/types/skills/lightning.d.ts.map +1 -0
- package/dist/types/skills/types.d.ts +548 -0
- package/dist/types/skills/types.d.ts.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @arkade-os/skill
|
|
2
|
+
|
|
3
|
+
Arkade SDK skills for agent integration - send and receive Bitcoin over Arkade, onchain via onboard/offboard, Lightning Network via Boltz, and swap USDC/USDT via LendaSwap.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Bitcoin on Arkade**: Instant offchain Bitcoin transactions
|
|
8
|
+
- **Onchain Payments**: Get paid onchain (onboard) and pay onchain (offboard)
|
|
9
|
+
- **Lightning Network**: Pay and receive via Boltz submarine swaps
|
|
10
|
+
- **Stablecoin Swaps**: Trade BTC for USDC/USDT on Polygon, Ethereum, Arbitrum
|
|
11
|
+
- **CLI for Agents**: Command-line interface designed for MoltBot and other agents
|
|
12
|
+
|
|
13
|
+
**Default Server:** https://arkade.computer
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @arkade-os/skill
|
|
19
|
+
# or
|
|
20
|
+
pnpm add @arkade-os/skill
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### CLI Usage
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Initialize wallet
|
|
29
|
+
arkade init <private-key-hex>
|
|
30
|
+
|
|
31
|
+
# Check balance
|
|
32
|
+
arkade balance
|
|
33
|
+
|
|
34
|
+
# Send Bitcoin
|
|
35
|
+
arkade send <ark-address> 50000
|
|
36
|
+
|
|
37
|
+
# Create Lightning invoice
|
|
38
|
+
arkade ln-invoice 25000 "Coffee payment"
|
|
39
|
+
|
|
40
|
+
# Pay Lightning invoice
|
|
41
|
+
arkade ln-pay lnbc...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### SDK Usage
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
48
|
+
import {
|
|
49
|
+
ArkadeBitcoinSkill,
|
|
50
|
+
ArkaLightningSkill,
|
|
51
|
+
LendaSwapSkill,
|
|
52
|
+
} from "@arkade-os/skill";
|
|
53
|
+
|
|
54
|
+
// Create wallet
|
|
55
|
+
const wallet = await Wallet.create({
|
|
56
|
+
identity: SingleKey.fromHex(privateKeyHex),
|
|
57
|
+
arkServerUrl: "https://arkade.computer",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Bitcoin operations
|
|
61
|
+
const bitcoin = new ArkadeBitcoinSkill(wallet);
|
|
62
|
+
const balance = await bitcoin.getBalance();
|
|
63
|
+
await bitcoin.send({ address: "ark1...", amount: 50000 });
|
|
64
|
+
|
|
65
|
+
// Lightning operations
|
|
66
|
+
const lightning = new ArkaLightningSkill({ wallet, network: "bitcoin" });
|
|
67
|
+
const invoice = await lightning.createInvoice({ amount: 25000 });
|
|
68
|
+
|
|
69
|
+
// Stablecoin swaps
|
|
70
|
+
const lendaswap = new LendaSwapSkill({ wallet, apiKey: "..." });
|
|
71
|
+
const quote = await lendaswap.getQuoteBtcToStablecoin(100000, "usdc_pol");
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Available Skills
|
|
75
|
+
|
|
76
|
+
| Skill | Description |
|
|
77
|
+
|-------|-------------|
|
|
78
|
+
| `ArkadeBitcoinSkill` | Send/receive BTC via Arkade offchain, get paid onchain (onboard), pay onchain (offboard) |
|
|
79
|
+
| `ArkaLightningSkill` | Lightning payments via Boltz swaps |
|
|
80
|
+
| `LendaSwapSkill` | USDC/USDT swaps via LendaSwap |
|
|
81
|
+
|
|
82
|
+
## CLI Commands
|
|
83
|
+
|
|
84
|
+
| Command | Description |
|
|
85
|
+
|---------|-------------|
|
|
86
|
+
| `init <key> [url]` | Initialize wallet |
|
|
87
|
+
| `address` | Show Ark address |
|
|
88
|
+
| `boarding-address` | Show boarding address |
|
|
89
|
+
| `balance` | Show balance breakdown |
|
|
90
|
+
| `send <addr> <amt>` | Send sats |
|
|
91
|
+
| `history` | Transaction history |
|
|
92
|
+
| `onboard` | Get paid onchain: convert received onchain BTC to offchain |
|
|
93
|
+
| `offboard <addr>` | Pay onchain: send offchain BTC to an onchain address |
|
|
94
|
+
| `ln-invoice <amt>` | Create Lightning invoice |
|
|
95
|
+
| `ln-pay <bolt11>` | Pay Lightning invoice |
|
|
96
|
+
| `ln-fees` | Show swap fees |
|
|
97
|
+
| `ln-limits` | Show swap limits |
|
|
98
|
+
| `swap-quote <amt> <from> <to>` | Get stablecoin quote |
|
|
99
|
+
| `swap-to-stable <amt> <token> <chain> <addr>` | Swap BTC to stablecoin |
|
|
100
|
+
| `swap-to-btc <amt> <token> <chain> <addr>` | Swap stablecoin to BTC |
|
|
101
|
+
| `swap-status <id>` | Check swap status |
|
|
102
|
+
| `swap-pending` | Show pending swaps |
|
|
103
|
+
| `swap-pairs` | Show trading pairs |
|
|
104
|
+
|
|
105
|
+
## Configuration
|
|
106
|
+
|
|
107
|
+
- **Data:** `~/.arkade-wallet/config.json`
|
|
108
|
+
- **Env:** `LENDASWAP_API_KEY` for stablecoin swaps
|
|
109
|
+
|
|
110
|
+
## Documentation
|
|
111
|
+
|
|
112
|
+
See [SKILL.md](./SKILL.md) for detailed agent integration documentation.
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkade
|
|
3
|
+
description: Send and receive Bitcoin over Arkade (offchain), onchain (via onboard/offboard), and Lightning. Swap USDC/USDT stablecoins.
|
|
4
|
+
read_when:
|
|
5
|
+
- user wants to send or receive Bitcoin
|
|
6
|
+
- user mentions Arkade, Ark, or offchain Bitcoin
|
|
7
|
+
- user wants to use Lightning Network
|
|
8
|
+
- user wants to swap BTC for stablecoins (USDC, USDT)
|
|
9
|
+
- user wants to on-ramp or off-ramp Bitcoin
|
|
10
|
+
- user wants to get paid onchain or pay someone onchain
|
|
11
|
+
- user mentions boarding address or VTXOs
|
|
12
|
+
- user wants instant Bitcoin payments
|
|
13
|
+
metadata:
|
|
14
|
+
emoji: "₿"
|
|
15
|
+
requires:
|
|
16
|
+
- private key (64 hex characters)
|
|
17
|
+
- LENDASWAP_API_KEY (for stablecoin swaps)
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Arkade Skill
|
|
21
|
+
|
|
22
|
+
Send and receive Bitcoin over Arkade (offchain), onchain (via onboard/offboard), and Lightning Network.
|
|
23
|
+
Swap between BTC and stablecoins (USDC/USDT) via LendaSwap.
|
|
24
|
+
|
|
25
|
+
**Payment methods:**
|
|
26
|
+
- **Offchain (Arkade)**: Instant transactions between Arkade wallets
|
|
27
|
+
- **Onchain**: Get paid onchain via boarding address (onboard), pay onchain via offboard
|
|
28
|
+
- **Lightning**: Pay and receive via Boltz submarine swaps
|
|
29
|
+
|
|
30
|
+
**Default Server:** https://arkade.computer
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @arkade-os/skill
|
|
36
|
+
# or
|
|
37
|
+
pnpm add @arkade-os/skill
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## CLI Commands
|
|
41
|
+
|
|
42
|
+
### Wallet Management
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Initialize wallet with private key (default server: arkade.computer)
|
|
46
|
+
arkade init <private-key-hex>
|
|
47
|
+
|
|
48
|
+
# Initialize with custom server
|
|
49
|
+
arkade init <private-key-hex> https://custom-server.com
|
|
50
|
+
|
|
51
|
+
# Show Ark address (for receiving offchain Bitcoin)
|
|
52
|
+
arkade address
|
|
53
|
+
|
|
54
|
+
# Show boarding address (for onchain deposits)
|
|
55
|
+
arkade boarding-address
|
|
56
|
+
|
|
57
|
+
# Show balance breakdown
|
|
58
|
+
arkade balance
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Bitcoin Transactions
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Send sats to an Ark address
|
|
65
|
+
arkade send <ark-address> <amount-sats>
|
|
66
|
+
|
|
67
|
+
# Example: Send 50,000 sats
|
|
68
|
+
arkade send ark1qxyz... 50000
|
|
69
|
+
|
|
70
|
+
# View transaction history
|
|
71
|
+
arkade history
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Onchain Payments (Onboard/Offboard)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Get paid onchain: Receive BTC to your boarding address, then onboard to Arkade
|
|
78
|
+
# Step 1: Get your boarding address
|
|
79
|
+
arkade boarding-address
|
|
80
|
+
|
|
81
|
+
# Step 2: Have someone send BTC to your boarding address
|
|
82
|
+
|
|
83
|
+
# Step 3: Onboard the received BTC to make it available offchain
|
|
84
|
+
arkade onboard
|
|
85
|
+
|
|
86
|
+
# Pay onchain: Send offchain BTC to any onchain Bitcoin address
|
|
87
|
+
arkade offboard <btc-address>
|
|
88
|
+
|
|
89
|
+
# Example: Pay someone at bc1 address
|
|
90
|
+
arkade offboard bc1qxyz...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Lightning Network
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Create a Lightning invoice to receive payment
|
|
97
|
+
arkade ln-invoice <amount-sats> [description]
|
|
98
|
+
|
|
99
|
+
# Example: Create invoice for 25,000 sats
|
|
100
|
+
arkade ln-invoice 25000 "Coffee payment"
|
|
101
|
+
|
|
102
|
+
# Pay a Lightning invoice
|
|
103
|
+
arkade ln-pay <bolt11-invoice>
|
|
104
|
+
|
|
105
|
+
# Show swap fees
|
|
106
|
+
arkade ln-fees
|
|
107
|
+
|
|
108
|
+
# Show swap limits
|
|
109
|
+
arkade ln-limits
|
|
110
|
+
|
|
111
|
+
# Show pending swaps
|
|
112
|
+
arkade ln-pending
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Stablecoin Swaps (LendaSwap)
|
|
116
|
+
|
|
117
|
+
Requires `LENDASWAP_API_KEY` environment variable.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Get quote for BTC to stablecoin swap
|
|
121
|
+
arkade swap-quote <amount-sats> <from> <to>
|
|
122
|
+
|
|
123
|
+
# Example: Quote 100,000 sats to USDC on Polygon
|
|
124
|
+
arkade swap-quote 100000 btc_arkade usdc_pol
|
|
125
|
+
|
|
126
|
+
# Show available trading pairs
|
|
127
|
+
arkade swap-pairs
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Supported Tokens:**
|
|
131
|
+
- `btc_arkade` - Bitcoin on Arkade
|
|
132
|
+
- `usdc_pol` - USDC on Polygon
|
|
133
|
+
- `usdc_eth` - USDC on Ethereum
|
|
134
|
+
- `usdc_arb` - USDC on Arbitrum
|
|
135
|
+
- `usdt_pol` - USDT on Polygon
|
|
136
|
+
- `usdt_eth` - USDT on Ethereum
|
|
137
|
+
- `usdt_arb` - USDT on Arbitrum
|
|
138
|
+
|
|
139
|
+
## SDK Usage
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
143
|
+
import {
|
|
144
|
+
ArkadeBitcoinSkill,
|
|
145
|
+
ArkaLightningSkill,
|
|
146
|
+
LendaSwapSkill,
|
|
147
|
+
} from "@arkade-os/skill";
|
|
148
|
+
|
|
149
|
+
// Create wallet (default server: arkade.computer)
|
|
150
|
+
const wallet = await Wallet.create({
|
|
151
|
+
identity: SingleKey.fromHex(privateKeyHex),
|
|
152
|
+
arkServerUrl: "https://arkade.computer",
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// === Bitcoin Operations ===
|
|
156
|
+
const bitcoin = new ArkadeBitcoinSkill(wallet);
|
|
157
|
+
|
|
158
|
+
// Get addresses
|
|
159
|
+
const arkAddress = await bitcoin.getArkAddress();
|
|
160
|
+
const boardingAddress = await bitcoin.getBoardingAddress();
|
|
161
|
+
|
|
162
|
+
// Check balance
|
|
163
|
+
const balance = await bitcoin.getBalance();
|
|
164
|
+
console.log("Total:", balance.total, "sats");
|
|
165
|
+
console.log("Offchain available:", balance.offchain.available, "sats");
|
|
166
|
+
console.log("Onchain pending:", balance.onchain.total, "sats");
|
|
167
|
+
|
|
168
|
+
// Send Bitcoin
|
|
169
|
+
const result = await bitcoin.send({
|
|
170
|
+
address: recipientArkAddress,
|
|
171
|
+
amount: 50000,
|
|
172
|
+
});
|
|
173
|
+
console.log("Sent! TX:", result.txid);
|
|
174
|
+
|
|
175
|
+
// === Lightning Operations ===
|
|
176
|
+
const lightning = new ArkaLightningSkill({
|
|
177
|
+
wallet,
|
|
178
|
+
network: "bitcoin",
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Create invoice
|
|
182
|
+
const invoice = await lightning.createInvoice({
|
|
183
|
+
amount: 25000,
|
|
184
|
+
description: "Coffee payment",
|
|
185
|
+
});
|
|
186
|
+
console.log("Invoice:", invoice.bolt11);
|
|
187
|
+
|
|
188
|
+
// Pay invoice
|
|
189
|
+
const payment = await lightning.payInvoice({
|
|
190
|
+
bolt11: "lnbc...",
|
|
191
|
+
});
|
|
192
|
+
console.log("Paid! Preimage:", payment.preimage);
|
|
193
|
+
|
|
194
|
+
// === Stablecoin Swaps ===
|
|
195
|
+
const lendaswap = new LendaSwapSkill({
|
|
196
|
+
wallet,
|
|
197
|
+
apiKey: process.env.LENDASWAP_API_KEY,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Get quote
|
|
201
|
+
const quote = await lendaswap.getQuoteBtcToStablecoin(100000, "usdc_pol");
|
|
202
|
+
console.log("You'll receive:", quote.targetAmount, "USDC");
|
|
203
|
+
|
|
204
|
+
// Execute swap
|
|
205
|
+
const swap = await lendaswap.swapBtcToStablecoin({
|
|
206
|
+
targetAddress: "0x...", // EVM address
|
|
207
|
+
targetToken: "usdc_pol",
|
|
208
|
+
targetChain: "polygon",
|
|
209
|
+
sourceAmount: 100000,
|
|
210
|
+
});
|
|
211
|
+
console.log("Swap ID:", swap.swapId);
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Configuration
|
|
215
|
+
|
|
216
|
+
**Data Storage:** `~/.arkade-wallet/config.json`
|
|
217
|
+
|
|
218
|
+
**Environment Variables:**
|
|
219
|
+
- `LENDASWAP_API_KEY` - Required for stablecoin swaps
|
|
220
|
+
|
|
221
|
+
## Skill Interfaces
|
|
222
|
+
|
|
223
|
+
### ArkadeBitcoinSkill
|
|
224
|
+
|
|
225
|
+
- `getArkAddress()` - Get Ark address for receiving offchain payments
|
|
226
|
+
- `getBoardingAddress()` - Get boarding address for receiving onchain payments
|
|
227
|
+
- `getBalance()` - Get balance breakdown
|
|
228
|
+
- `send(params)` - Send Bitcoin to Ark address (offchain)
|
|
229
|
+
- `getTransactionHistory()` - Get transaction history
|
|
230
|
+
- `onboard(params)` - Get paid onchain: convert onchain BTC to offchain
|
|
231
|
+
- `offboard(params)` - Pay onchain: send offchain BTC to any onchain address
|
|
232
|
+
- `waitForIncomingFunds(timeout?)` - Wait for incoming funds
|
|
233
|
+
|
|
234
|
+
### ArkaLightningSkill
|
|
235
|
+
|
|
236
|
+
- `createInvoice(params)` - Create Lightning invoice
|
|
237
|
+
- `payInvoice(params)` - Pay Lightning invoice
|
|
238
|
+
- `getFees()` - Get swap fees
|
|
239
|
+
- `getLimits()` - Get swap limits
|
|
240
|
+
- `getPendingSwaps()` - Get pending swaps
|
|
241
|
+
- `getSwapHistory()` - Get swap history
|
|
242
|
+
- `isAvailable()` - Check if Lightning is available
|
|
243
|
+
|
|
244
|
+
### LendaSwapSkill
|
|
245
|
+
|
|
246
|
+
- `getQuoteBtcToStablecoin(amount, token)` - Quote BTC to stablecoin
|
|
247
|
+
- `getQuoteStablecoinToBtc(amount, token)` - Quote stablecoin to BTC
|
|
248
|
+
- `swapBtcToStablecoin(params)` - Swap BTC to stablecoin
|
|
249
|
+
- `swapStablecoinToBtc(params)` - Swap stablecoin to BTC
|
|
250
|
+
- `getSwapStatus(swapId)` - Get swap status
|
|
251
|
+
- `getPendingSwaps()` - Get pending swaps
|
|
252
|
+
- `getSwapHistory()` - Get swap history
|
|
253
|
+
- `getAvailablePairs()` - Get available trading pairs
|
|
254
|
+
- `claimSwap(swapId)` - Claim completed swap
|
|
255
|
+
- `refundSwap(swapId)` - Refund expired swap
|
|
256
|
+
|
|
257
|
+
## Networks
|
|
258
|
+
|
|
259
|
+
Arkade supports multiple networks:
|
|
260
|
+
- `bitcoin` - Bitcoin mainnet
|
|
261
|
+
- `testnet` - Bitcoin testnet
|
|
262
|
+
- `signet` - Bitcoin signet
|
|
263
|
+
- `regtest` - Local regtest
|
|
264
|
+
- `mutinynet` - Mutiny signet
|
|
265
|
+
|
|
266
|
+
## Support
|
|
267
|
+
|
|
268
|
+
- GitHub: https://github.com/arkade-os/skill
|
|
269
|
+
- Documentation: https://docs.arkade.computer
|