@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
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArkaLightningSkill - Lightning Network payments via Boltz submarine swaps.
|
|
3
|
+
*
|
|
4
|
+
* This skill provides Lightning Network capabilities for Arkade wallets
|
|
5
|
+
* designed for agent integration (CLI-friendly for agents like MoltBot).
|
|
6
|
+
*
|
|
7
|
+
* @module skills/lightning
|
|
8
|
+
*/
|
|
9
|
+
import { ArkadeLightning, BoltzSwapProvider, decodeInvoice, } from "@arkade-os/boltz-swap";
|
|
10
|
+
/**
|
|
11
|
+
* Default Boltz API URLs by network.
|
|
12
|
+
*/
|
|
13
|
+
const BOLTZ_API_URLS = {
|
|
14
|
+
bitcoin: "https://api.boltz.exchange",
|
|
15
|
+
mainnet: "https://api.boltz.exchange",
|
|
16
|
+
testnet: "https://testnet.boltz.exchange/api",
|
|
17
|
+
signet: "https://testnet.boltz.exchange/api",
|
|
18
|
+
regtest: "http://localhost:9001",
|
|
19
|
+
mutinynet: "https://mutinynet.boltz.exchange/api",
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* ArkaLightningSkill provides Lightning Network payment capabilities
|
|
23
|
+
* for Arkade wallets using Boltz submarine swaps.
|
|
24
|
+
*
|
|
25
|
+
* This skill enables:
|
|
26
|
+
* - Receiving Lightning payments into your Arkade wallet (reverse swaps)
|
|
27
|
+
* - Sending Lightning payments from your Arkade wallet (submarine swaps)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
32
|
+
* import { ArkaLightningSkill } from "@arkade-os/skill";
|
|
33
|
+
*
|
|
34
|
+
* // Create a wallet
|
|
35
|
+
* const wallet = await Wallet.create({
|
|
36
|
+
* identity: SingleKey.fromHex(privateKeyHex),
|
|
37
|
+
* arkServerUrl: "https://arkade.computer",
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Create the Lightning skill
|
|
41
|
+
* const lightning = new ArkaLightningSkill({
|
|
42
|
+
* wallet,
|
|
43
|
+
* network: "bitcoin",
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Create an invoice to receive Lightning payment
|
|
47
|
+
* const invoice = await lightning.createInvoice({
|
|
48
|
+
* amount: 50000, // 50,000 sats
|
|
49
|
+
* description: "Payment for coffee",
|
|
50
|
+
* });
|
|
51
|
+
* console.log("Pay this invoice:", invoice.bolt11);
|
|
52
|
+
*
|
|
53
|
+
* // Pay a Lightning invoice
|
|
54
|
+
* const result = await lightning.payInvoice({
|
|
55
|
+
* bolt11: "lnbc...",
|
|
56
|
+
* });
|
|
57
|
+
* console.log("Paid! Preimage:", result.preimage);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export class ArkaLightningSkill {
|
|
61
|
+
/**
|
|
62
|
+
* Creates a new ArkaLightningSkill instance.
|
|
63
|
+
*
|
|
64
|
+
* @param config - Configuration options
|
|
65
|
+
*/
|
|
66
|
+
constructor(config) {
|
|
67
|
+
this.name = "arka-lightning";
|
|
68
|
+
this.description = "Lightning Network payments via Boltz submarine swaps for Arkade wallets";
|
|
69
|
+
this.version = "1.0.0";
|
|
70
|
+
this.network = config.network;
|
|
71
|
+
const boltzApiUrl = config.boltzApiUrl ||
|
|
72
|
+
BOLTZ_API_URLS[config.network] ||
|
|
73
|
+
BOLTZ_API_URLS.bitcoin;
|
|
74
|
+
this.swapProvider = new BoltzSwapProvider({
|
|
75
|
+
apiUrl: boltzApiUrl,
|
|
76
|
+
network: config.network,
|
|
77
|
+
referralId: config.referralId,
|
|
78
|
+
});
|
|
79
|
+
// Cast wallet to any since boltz-swap expects Wallet from @arkade-os/sdk
|
|
80
|
+
// but we have the local Wallet type - they are structurally identical
|
|
81
|
+
this.arkadeLightning = new ArkadeLightning({
|
|
82
|
+
wallet: config.wallet,
|
|
83
|
+
swapProvider: this.swapProvider,
|
|
84
|
+
arkProvider: config.arkProvider,
|
|
85
|
+
indexerProvider: config.indexerProvider,
|
|
86
|
+
swapManager: config.enableSwapManager
|
|
87
|
+
? { enableAutoActions: true, autoStart: true }
|
|
88
|
+
: undefined,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if the Lightning skill is available.
|
|
93
|
+
*
|
|
94
|
+
* @returns true if the skill is properly configured
|
|
95
|
+
*/
|
|
96
|
+
async isAvailable() {
|
|
97
|
+
try {
|
|
98
|
+
await this.swapProvider.getFees();
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a Lightning invoice for receiving payment.
|
|
107
|
+
*
|
|
108
|
+
* This creates a Boltz reverse swap, which locks funds on Boltz's side
|
|
109
|
+
* when someone pays the invoice. The funds are then claimed into your
|
|
110
|
+
* Arkade wallet as VTXOs.
|
|
111
|
+
*
|
|
112
|
+
* @param params - Invoice parameters
|
|
113
|
+
* @returns The created invoice with payment details
|
|
114
|
+
*/
|
|
115
|
+
async createInvoice(params) {
|
|
116
|
+
const response = await this.arkadeLightning.createLightningInvoice({
|
|
117
|
+
amount: params.amount,
|
|
118
|
+
description: params.description,
|
|
119
|
+
});
|
|
120
|
+
// Extract expiry from invoice
|
|
121
|
+
const decoded = decodeInvoice(response.invoice);
|
|
122
|
+
return {
|
|
123
|
+
bolt11: response.invoice,
|
|
124
|
+
paymentHash: response.paymentHash,
|
|
125
|
+
amount: response.amount,
|
|
126
|
+
description: params.description,
|
|
127
|
+
expirySeconds: decoded.expiry,
|
|
128
|
+
createdAt: new Date(),
|
|
129
|
+
preimage: response.preimage,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Pay a Lightning invoice.
|
|
134
|
+
*
|
|
135
|
+
* This creates a Boltz submarine swap, which sends funds from your
|
|
136
|
+
* Arkade wallet to a swap address. Boltz then pays the Lightning invoice
|
|
137
|
+
* and you receive the preimage as proof of payment.
|
|
138
|
+
*
|
|
139
|
+
* @param params - Payment parameters
|
|
140
|
+
* @returns Result containing the preimage and transaction details
|
|
141
|
+
*/
|
|
142
|
+
async payInvoice(params) {
|
|
143
|
+
const response = await this.arkadeLightning.sendLightningPayment({
|
|
144
|
+
invoice: params.bolt11,
|
|
145
|
+
});
|
|
146
|
+
return {
|
|
147
|
+
preimage: response.preimage,
|
|
148
|
+
amount: response.amount,
|
|
149
|
+
txid: response.txid,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get fee information for Lightning swaps.
|
|
154
|
+
*
|
|
155
|
+
* @returns Fee structure for submarine and reverse swaps
|
|
156
|
+
*/
|
|
157
|
+
async getFees() {
|
|
158
|
+
return this.arkadeLightning.getFees();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get limits for Lightning swaps.
|
|
162
|
+
*
|
|
163
|
+
* @returns Min and max amounts for swaps
|
|
164
|
+
*/
|
|
165
|
+
async getLimits() {
|
|
166
|
+
return this.arkadeLightning.getLimits();
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get pending swaps.
|
|
170
|
+
*
|
|
171
|
+
* @returns Array of pending swap information
|
|
172
|
+
*/
|
|
173
|
+
async getPendingSwaps() {
|
|
174
|
+
const [reverseSwaps, submarineSwaps] = await Promise.all([
|
|
175
|
+
this.arkadeLightning.getPendingReverseSwaps(),
|
|
176
|
+
this.arkadeLightning.getPendingSubmarineSwaps(),
|
|
177
|
+
]);
|
|
178
|
+
return [
|
|
179
|
+
...reverseSwaps.map((swap) => this.mapReverseSwap(swap)),
|
|
180
|
+
...submarineSwaps.map((swap) => this.mapSubmarineSwap(swap)),
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get swap history.
|
|
185
|
+
*
|
|
186
|
+
* @returns Array of all swaps (pending and completed)
|
|
187
|
+
*/
|
|
188
|
+
async getSwapHistory() {
|
|
189
|
+
const history = await this.arkadeLightning.getSwapHistory();
|
|
190
|
+
return history.map((swap) => swap.type === "reverse"
|
|
191
|
+
? this.mapReverseSwap(swap)
|
|
192
|
+
: this.mapSubmarineSwap(swap));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Wait for an invoice to be paid and claim the funds.
|
|
196
|
+
*
|
|
197
|
+
* @param pendingSwap - The pending reverse swap from createInvoice
|
|
198
|
+
* @returns Transaction ID of the claimed funds
|
|
199
|
+
*/
|
|
200
|
+
async waitAndClaim(pendingSwap) {
|
|
201
|
+
return this.arkadeLightning.waitAndClaim(pendingSwap);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get the underlying ArkadeLightning instance for advanced operations.
|
|
205
|
+
*
|
|
206
|
+
* @returns The ArkadeLightning instance
|
|
207
|
+
*/
|
|
208
|
+
getArkadeLightning() {
|
|
209
|
+
return this.arkadeLightning;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get the swap provider for direct Boltz API access.
|
|
213
|
+
*
|
|
214
|
+
* @returns The BoltzSwapProvider instance
|
|
215
|
+
*/
|
|
216
|
+
getSwapProvider() {
|
|
217
|
+
return this.swapProvider;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Start the background swap manager if enabled.
|
|
221
|
+
*/
|
|
222
|
+
async startSwapManager() {
|
|
223
|
+
await this.arkadeLightning.startSwapManager();
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Stop the background swap manager.
|
|
227
|
+
*/
|
|
228
|
+
async stopSwapManager() {
|
|
229
|
+
await this.arkadeLightning.stopSwapManager();
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Dispose of resources and stop the swap manager.
|
|
233
|
+
*/
|
|
234
|
+
async dispose() {
|
|
235
|
+
await this.arkadeLightning.dispose();
|
|
236
|
+
}
|
|
237
|
+
mapReverseSwap(swap) {
|
|
238
|
+
return {
|
|
239
|
+
id: swap.id,
|
|
240
|
+
type: "reverse",
|
|
241
|
+
status: swap.status,
|
|
242
|
+
amount: swap.response.onchainAmount,
|
|
243
|
+
createdAt: new Date(swap.createdAt),
|
|
244
|
+
invoice: swap.response.invoice,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
mapSubmarineSwap(swap) {
|
|
248
|
+
// Decode invoice to get amount
|
|
249
|
+
let amount = 0;
|
|
250
|
+
try {
|
|
251
|
+
const decoded = decodeInvoice(swap.request.invoice);
|
|
252
|
+
amount = decoded.amountSats;
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
amount = swap.response.expectedAmount;
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
id: swap.id,
|
|
259
|
+
type: "submarine",
|
|
260
|
+
status: swap.status,
|
|
261
|
+
amount,
|
|
262
|
+
createdAt: new Date(swap.createdAt),
|
|
263
|
+
invoice: swap.request.invoice,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Create an ArkaLightningSkill from a wallet and network.
|
|
269
|
+
*
|
|
270
|
+
* @param wallet - The Arkade wallet to use
|
|
271
|
+
* @param network - The network name
|
|
272
|
+
* @param options - Optional configuration
|
|
273
|
+
* @returns A new ArkaLightningSkill instance
|
|
274
|
+
*/
|
|
275
|
+
export function createLightningSkill(wallet, network, options) {
|
|
276
|
+
return new ArkaLightningSkill({
|
|
277
|
+
wallet,
|
|
278
|
+
network,
|
|
279
|
+
...options,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=lightning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightning.js","sourceRoot":"","sources":["../../../src/skills/lightning.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,aAAa,GAGd,MAAM,uBAAuB,CAAC;AAe/B;;GAEG;AACH,MAAM,cAAc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,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/skills/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @arkade-os/skill - Arkade SDK Skills for Agent Integration
|
|
3
|
+
*
|
|
4
|
+
* This package provides skills for sending and receiving Bitcoin over
|
|
5
|
+
* Arkade and Lightning, designed for agent integration (CLI-friendly
|
|
6
|
+
* for agents like MoltBot).
|
|
7
|
+
*
|
|
8
|
+
* ## Available Skills
|
|
9
|
+
*
|
|
10
|
+
* - **ArkadeBitcoinSkill**: Send/receive Bitcoin via Arkade with on/off ramp support
|
|
11
|
+
* - **ArkaLightningSkill**: Lightning Network payments via Boltz submarine swaps
|
|
12
|
+
* - **LendaSwapSkill**: USDC/USDT stablecoin swaps via LendaSwap
|
|
13
|
+
*
|
|
14
|
+
* ## Quick Start
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
18
|
+
* import {
|
|
19
|
+
* ArkadeBitcoinSkill,
|
|
20
|
+
* ArkaLightningSkill,
|
|
21
|
+
* LendaSwapSkill,
|
|
22
|
+
* } from "@arkade-os/skill";
|
|
23
|
+
*
|
|
24
|
+
* // Create a wallet (default server: arkade.computer)
|
|
25
|
+
* const wallet = await Wallet.create({
|
|
26
|
+
* identity: SingleKey.fromHex(privateKeyHex),
|
|
27
|
+
* arkServerUrl: "https://arkade.computer",
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Bitcoin operations
|
|
31
|
+
* const bitcoin = new ArkadeBitcoinSkill(wallet);
|
|
32
|
+
* const balance = await bitcoin.getBalance();
|
|
33
|
+
*
|
|
34
|
+
* // Lightning operations
|
|
35
|
+
* const lightning = new ArkaLightningSkill({ wallet, network: "bitcoin" });
|
|
36
|
+
* const invoice = await lightning.createInvoice({ amount: 50000 });
|
|
37
|
+
*
|
|
38
|
+
* // Stablecoin swaps
|
|
39
|
+
* const lendaswap = new LendaSwapSkill({ wallet, apiKey: "..." });
|
|
40
|
+
* const quote = await lendaswap.getQuoteBtcToStablecoin(100000, "usdc_pol");
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ## CLI Usage
|
|
44
|
+
*
|
|
45
|
+
* ```bash
|
|
46
|
+
* # Initialize wallet (default server: arkade.computer)
|
|
47
|
+
* arkade init <private-key-hex>
|
|
48
|
+
*
|
|
49
|
+
* # Show addresses
|
|
50
|
+
* arkade address
|
|
51
|
+
* arkade boarding-address
|
|
52
|
+
*
|
|
53
|
+
* # Check balance
|
|
54
|
+
* arkade balance
|
|
55
|
+
*
|
|
56
|
+
* # Send Bitcoin
|
|
57
|
+
* arkade send <ark-address> <amount-sats>
|
|
58
|
+
*
|
|
59
|
+
* # Lightning
|
|
60
|
+
* arkade ln-invoice <amount> [description]
|
|
61
|
+
* arkade ln-pay <bolt11>
|
|
62
|
+
*
|
|
63
|
+
* # Stablecoins
|
|
64
|
+
* arkade swap-quote <amount> <from> <to>
|
|
65
|
+
* arkade swap-pairs
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @packageDocumentation
|
|
69
|
+
*/
|
|
70
|
+
export * from "./skills";
|
|
71
|
+
export type { Wallet, ArkTransaction, WalletBalance, ExtendedCoin, ExtendedVirtualCoin, FeeInfo, SettlementEvent, NetworkName, } from "@arkade-os/sdk";
|
|
72
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAGH,cAAc,UAAU,CAAC;AAGzB,YAAY,EACV,MAAM,EACN,cAAc,EACd,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ArkadeBitcoinSkill - Send and receive Bitcoin over Arkade protocol.
|
|
3
|
+
*
|
|
4
|
+
* This skill provides a unified interface for Bitcoin operations
|
|
5
|
+
* designed for agent integration (CLI-friendly for agents like MoltBot).
|
|
6
|
+
*
|
|
7
|
+
* @module skills/arkadeBitcoin
|
|
8
|
+
*/
|
|
9
|
+
import { Wallet, ArkTransaction, ExtendedCoin, ExtendedVirtualCoin } from "@arkade-os/sdk";
|
|
10
|
+
import type { BitcoinSkill, RampSkill, BitcoinAddress, SendParams, SendResult, BalanceInfo, IncomingFundsEvent, OnboardParams, OffboardParams, RampResult } from "./types";
|
|
11
|
+
/**
|
|
12
|
+
* ArkadeBitcoinSkill provides a unified interface for sending and receiving
|
|
13
|
+
* Bitcoin over the Arkade protocol.
|
|
14
|
+
*
|
|
15
|
+
* This skill wraps the core wallet functionality and provides:
|
|
16
|
+
* - Offchain Bitcoin transactions via Ark
|
|
17
|
+
* - Get paid onchain via boarding address + onboard
|
|
18
|
+
* - Pay onchain via offboard to any Bitcoin address
|
|
19
|
+
* - Balance management
|
|
20
|
+
* - Transaction history
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
25
|
+
* import { ArkadeBitcoinSkill } from "@arkade-os/skill";
|
|
26
|
+
*
|
|
27
|
+
* // Create a wallet
|
|
28
|
+
* const wallet = await Wallet.create({
|
|
29
|
+
* identity: SingleKey.fromHex(privateKeyHex),
|
|
30
|
+
* arkServerUrl: "https://arkade.computer",
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Create the skill
|
|
34
|
+
* const bitcoinSkill = new ArkadeBitcoinSkill(wallet);
|
|
35
|
+
*
|
|
36
|
+
* // Get addresses for receiving
|
|
37
|
+
* const addresses = await bitcoinSkill.getReceiveAddresses();
|
|
38
|
+
* console.log("Ark Address:", addresses[0].address);
|
|
39
|
+
*
|
|
40
|
+
* // Check balance
|
|
41
|
+
* const balance = await bitcoinSkill.getBalance();
|
|
42
|
+
* console.log("Available:", balance.offchain.available, "sats");
|
|
43
|
+
*
|
|
44
|
+
* // Send Bitcoin offchain
|
|
45
|
+
* const result = await bitcoinSkill.send({
|
|
46
|
+
* address: recipientArkAddress,
|
|
47
|
+
* amount: 10000, // 10,000 sats
|
|
48
|
+
* });
|
|
49
|
+
* console.log("Sent! Txid:", result.txid);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare class ArkadeBitcoinSkill implements BitcoinSkill, RampSkill {
|
|
53
|
+
private readonly wallet;
|
|
54
|
+
readonly name = "arkade-bitcoin";
|
|
55
|
+
readonly description = "Send and receive Bitcoin over Arkade offchain, get paid onchain (onboard), pay onchain (offboard)";
|
|
56
|
+
readonly version = "1.0.0";
|
|
57
|
+
private readonly ramps;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new ArkadeBitcoinSkill instance.
|
|
60
|
+
*
|
|
61
|
+
* @param wallet - The Arkade wallet to use for operations.
|
|
62
|
+
* Must be a full wallet (not readonly) for send/settle operations.
|
|
63
|
+
*/
|
|
64
|
+
constructor(wallet: Wallet);
|
|
65
|
+
/**
|
|
66
|
+
* Get all available addresses for receiving Bitcoin.
|
|
67
|
+
*
|
|
68
|
+
* Returns both the Ark address (for offchain receipts) and the
|
|
69
|
+
* boarding address (for onchain deposits that can be onboarded).
|
|
70
|
+
*
|
|
71
|
+
* @returns Array of addresses with their types and descriptions
|
|
72
|
+
*/
|
|
73
|
+
getReceiveAddresses(): Promise<BitcoinAddress[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Get the Ark address for receiving offchain Bitcoin.
|
|
76
|
+
*
|
|
77
|
+
* This is the primary address for receiving Bitcoin via Arkade.
|
|
78
|
+
* Funds sent to this address are immediately available offchain.
|
|
79
|
+
*
|
|
80
|
+
* @returns The bech32m-encoded Ark address
|
|
81
|
+
*/
|
|
82
|
+
getArkAddress(): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Get the boarding address for receiving onchain Bitcoin.
|
|
85
|
+
*
|
|
86
|
+
* Funds sent to this address appear as boarding UTXOs and must be
|
|
87
|
+
* onboarded to become offchain VTXOs before they can be spent.
|
|
88
|
+
*
|
|
89
|
+
* @returns The Bitcoin boarding address
|
|
90
|
+
*/
|
|
91
|
+
getBoardingAddress(): Promise<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Get the current balance with detailed breakdown.
|
|
94
|
+
*
|
|
95
|
+
* @returns Balance information including offchain and onchain amounts
|
|
96
|
+
*/
|
|
97
|
+
getBalance(): Promise<BalanceInfo>;
|
|
98
|
+
/**
|
|
99
|
+
* Send Bitcoin to an address.
|
|
100
|
+
*
|
|
101
|
+
* For Ark addresses, this creates an offchain transaction that is
|
|
102
|
+
* instantly confirmed. The recipient must also be using an Ark-compatible
|
|
103
|
+
* wallet connected to the same Ark server.
|
|
104
|
+
*
|
|
105
|
+
* @param params - Send parameters including address and amount
|
|
106
|
+
* @returns Result containing the transaction ID and details
|
|
107
|
+
* @throws Error if the address is invalid or insufficient balance
|
|
108
|
+
*/
|
|
109
|
+
send(params: SendParams): Promise<SendResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Get the transaction history.
|
|
112
|
+
*
|
|
113
|
+
* @returns Array of transactions with type, amount, and status
|
|
114
|
+
*/
|
|
115
|
+
getTransactionHistory(): Promise<ArkTransaction[]>;
|
|
116
|
+
/**
|
|
117
|
+
* Wait for incoming funds.
|
|
118
|
+
*
|
|
119
|
+
* This method blocks until either:
|
|
120
|
+
* - New VTXOs are received (offchain)
|
|
121
|
+
* - New UTXOs are received at the boarding address (onchain)
|
|
122
|
+
* - The timeout expires
|
|
123
|
+
*
|
|
124
|
+
* @param timeoutMs - Optional timeout in milliseconds (default: no timeout)
|
|
125
|
+
* @returns Information about the received funds
|
|
126
|
+
* @throws Error if timeout expires without receiving funds
|
|
127
|
+
*/
|
|
128
|
+
waitForIncomingFunds(timeoutMs?: number): Promise<IncomingFundsEvent>;
|
|
129
|
+
/**
|
|
130
|
+
* Get paid onchain: Convert received onchain BTC to offchain.
|
|
131
|
+
*
|
|
132
|
+
* Use this after receiving onchain Bitcoin to your boarding address.
|
|
133
|
+
* This converts boarding UTXOs into VTXOs through a cooperative
|
|
134
|
+
* settlement with the Ark server. After onboarding, funds are
|
|
135
|
+
* available for instant offchain transactions.
|
|
136
|
+
*
|
|
137
|
+
* Flow: Someone pays you onchain → funds arrive at boarding address → onboard → funds available offchain
|
|
138
|
+
*
|
|
139
|
+
* @param params - Onboard parameters
|
|
140
|
+
* @returns Result containing the commitment transaction ID
|
|
141
|
+
* @throws Error if no boarding UTXOs are available or fees exceed value
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* // Step 1: Give your boarding address to receive onchain payment
|
|
146
|
+
* const boardingAddress = await bitcoinSkill.getBoardingAddress();
|
|
147
|
+
*
|
|
148
|
+
* // Step 2: After receiving payment, onboard the funds
|
|
149
|
+
* const arkInfo = await arkProvider.getInfo();
|
|
150
|
+
* const result = await bitcoinSkill.onboard({
|
|
151
|
+
* feeInfo: arkInfo.feeInfo,
|
|
152
|
+
* eventCallback: (event) => console.log("Settlement event:", event.type),
|
|
153
|
+
* });
|
|
154
|
+
* console.log("Onboarded! Commitment:", result.commitmentTxid);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
onboard(params: OnboardParams): Promise<RampResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Pay onchain: Send offchain BTC to any onchain Bitcoin address.
|
|
160
|
+
*
|
|
161
|
+
* Use this to pay someone who needs onchain Bitcoin. This performs a
|
|
162
|
+
* collaborative exit, converting your VTXOs back to regular onchain
|
|
163
|
+
* Bitcoin UTXOs at the recipient's destination address.
|
|
164
|
+
*
|
|
165
|
+
* Flow: You have offchain funds → offboard to recipient's onchain address → they receive onchain BTC
|
|
166
|
+
*
|
|
167
|
+
* @param params - Offboard parameters including destination address
|
|
168
|
+
* @returns Result containing the commitment transaction ID
|
|
169
|
+
* @throws Error if no VTXOs are available or fees exceed value
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* // Pay someone at an onchain Bitcoin address
|
|
174
|
+
* const arkInfo = await arkProvider.getInfo();
|
|
175
|
+
* const result = await bitcoinSkill.offboard({
|
|
176
|
+
* destinationAddress: "bc1q...", // recipient's onchain address
|
|
177
|
+
* feeInfo: arkInfo.feeInfo,
|
|
178
|
+
* eventCallback: (event) => console.log("Settlement event:", event.type),
|
|
179
|
+
* });
|
|
180
|
+
* console.log("Paid onchain! Commitment:", result.commitmentTxid);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
offboard(params: OffboardParams): Promise<RampResult>;
|
|
184
|
+
/**
|
|
185
|
+
* Get the underlying wallet instance.
|
|
186
|
+
*
|
|
187
|
+
* Use this for advanced operations not covered by the skill interface.
|
|
188
|
+
*
|
|
189
|
+
* @returns The wallet instance
|
|
190
|
+
*/
|
|
191
|
+
getWallet(): Wallet;
|
|
192
|
+
/**
|
|
193
|
+
* Get detailed information about available VTXOs.
|
|
194
|
+
*
|
|
195
|
+
* @param filter - Optional filter for VTXO types to include
|
|
196
|
+
* @returns Array of extended virtual coins with full details
|
|
197
|
+
*/
|
|
198
|
+
getVtxos(filter?: {
|
|
199
|
+
withRecoverable?: boolean;
|
|
200
|
+
withUnrolled?: boolean;
|
|
201
|
+
}): Promise<ExtendedVirtualCoin[]>;
|
|
202
|
+
/**
|
|
203
|
+
* Get detailed information about boarding UTXOs.
|
|
204
|
+
*
|
|
205
|
+
* @returns Array of extended coins with full details
|
|
206
|
+
*/
|
|
207
|
+
getBoardingUtxos(): Promise<ExtendedCoin[]>;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Create an ArkadeBitcoinSkill from a wallet.
|
|
211
|
+
*
|
|
212
|
+
* This is a convenience function for creating the skill.
|
|
213
|
+
*
|
|
214
|
+
* @param wallet - The Arkade wallet to use
|
|
215
|
+
* @returns A new ArkadeBitcoinSkill instance
|
|
216
|
+
*/
|
|
217
|
+
export declare function createArkadeBitcoinSkill(wallet: Wallet): ArkadeBitcoinSkill;
|
|
218
|
+
//# sourceMappingURL=arkadeBitcoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arkadeBitcoin.d.ts","sourceRoot":"","sources":["../../../src/skills/arkadeBitcoin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,MAAM,EAEN,cAAc,EACd,YAAY,EACZ,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBAAa,kBAAmB,YAAW,YAAY,EAAE,SAAS;IAcpD,OAAO,CAAC,QAAQ,CAAC,MAAM;IAbnC,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,WAAW,uGACkF;IACtG,QAAQ,CAAC,OAAO,WAAW;IAE3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAE9B;;;;;OAKG;gBAC0B,MAAM,EAAE,MAAM;IAI3C;;;;;;;OAOG;IACG,mBAAmB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAqBtD;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAItC;;;;;;;OAOG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAI3C;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IAmBxC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAenD;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxD;;;;;;;;;;;OAWG;IACG,oBAAoB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBzD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC;IAsB3D;;;;;;OAMG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;IACG,QAAQ,CAAC,MAAM,CAAC,EAAE;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIlC;;;;OAIG;IACG,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAGlD;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAE3E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills module for the Arkade SDK.
|
|
3
|
+
*
|
|
4
|
+
* Skills are modular capabilities that provide specific functionality for agents
|
|
5
|
+
* and applications. This module provides skills for:
|
|
6
|
+
*
|
|
7
|
+
* - **ArkadeBitcoinSkill**: Send and receive Bitcoin over Arkade
|
|
8
|
+
* - **ArkaLightningSkill**: Lightning Network payments via Boltz swaps
|
|
9
|
+
* - **LendaSwapSkill**: USDC/USDT stablecoin swaps via LendaSwap
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { Wallet, SingleKey } from "@arkade-os/sdk";
|
|
14
|
+
* import {
|
|
15
|
+
* ArkadeBitcoinSkill,
|
|
16
|
+
* ArkaLightningSkill,
|
|
17
|
+
* LendaSwapSkill,
|
|
18
|
+
* } from "@arkade-os/skill";
|
|
19
|
+
*
|
|
20
|
+
* // Create a wallet
|
|
21
|
+
* const wallet = await Wallet.create({
|
|
22
|
+
* identity: SingleKey.fromHex(privateKeyHex),
|
|
23
|
+
* arkServerUrl: "https://arkade.computer",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // === Bitcoin Skill ===
|
|
27
|
+
* const bitcoin = new ArkadeBitcoinSkill(wallet);
|
|
28
|
+
*
|
|
29
|
+
* // Get addresses for receiving
|
|
30
|
+
* const arkAddress = await bitcoin.getArkAddress();
|
|
31
|
+
* console.log("Ark address:", arkAddress);
|
|
32
|
+
*
|
|
33
|
+
* // Check balance
|
|
34
|
+
* const balance = await bitcoin.getBalance();
|
|
35
|
+
* console.log("Balance:", balance.total, "sats");
|
|
36
|
+
*
|
|
37
|
+
* // === Lightning Skill ===
|
|
38
|
+
* const lightning = new ArkaLightningSkill({
|
|
39
|
+
* wallet,
|
|
40
|
+
* network: "bitcoin",
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Create invoice to receive Lightning payment
|
|
44
|
+
* const invoice = await lightning.createInvoice({
|
|
45
|
+
* amount: 25000,
|
|
46
|
+
* description: "Coffee payment",
|
|
47
|
+
* });
|
|
48
|
+
* console.log("Invoice:", invoice.bolt11);
|
|
49
|
+
*
|
|
50
|
+
* // === LendaSwap Skill ===
|
|
51
|
+
* const lendaswap = new LendaSwapSkill({
|
|
52
|
+
* wallet,
|
|
53
|
+
* apiKey: process.env.LENDASWAP_API_KEY,
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* // Get quote for BTC to USDC
|
|
57
|
+
* const quote = await lendaswap.getQuoteBtcToStablecoin(100000, "usdc_pol");
|
|
58
|
+
* console.log("Quote:", quote.targetAmount, "USDC");
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @module skills
|
|
62
|
+
*/
|
|
63
|
+
export type { Skill, BitcoinSkill, RampSkill, LightningSkill, StablecoinSwapSkill, BitcoinAddress, SendParams, SendResult, BalanceInfo, IncomingFundsEvent, OnboardParams, OffboardParams, RampResult, LightningInvoice, CreateInvoiceParams, PayInvoiceParams, PaymentResult, LightningFees, LightningLimits, SwapStatus, SwapInfo, EvmChain, StablecoinToken, BtcSource, BtcToStablecoinParams, StablecoinToBtcParams, StablecoinSwapResult, StablecoinSwapStatus, StablecoinSwapInfo, StablecoinQuote, StablecoinPair, } from "./types";
|
|
64
|
+
export { ArkadeBitcoinSkill, createArkadeBitcoinSkill } from "./arkadeBitcoin";
|
|
65
|
+
export { ArkaLightningSkill, createLightningSkill, type ArkaLightningSkillConfig, } from "./lightning";
|
|
66
|
+
export { LendaSwapSkill, createLendaSwapSkill, type LendaSwapSkillConfig, } from "./lendaswap";
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAGH,YAAY,EACV,KAAK,EACL,YAAY,EACZ,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,eAAe,EACf,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,cAAc,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAG/E,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC"}
|