@satora/escrow-client 0.0.1-alpha.4 → 0.0.1
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 +9 -9
- package/dist/escrow-client.d.ts +7 -7
- package/dist/escrow-client.d.ts.map +1 -1
- package/dist/escrow-client.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Peer dependencies (you provide these):
|
|
|
21
21
|
npm install @arkade-os/sdk @satora/swap
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
- `@arkade-os/sdk` —
|
|
24
|
+
- `@arkade-os/sdk` — Arkade providers, repositories, and the `Wallet` used for withdrawals.
|
|
25
25
|
- `@satora/swap` — the Satora swap client: the Lightning/L1 on/off-ramp. You
|
|
26
26
|
build one (shown below) and inject it; escrow-client only imports its type, so it
|
|
27
27
|
carries none of that bundle's runtime weight.
|
|
@@ -45,7 +45,7 @@ const swap = await Client.builder()
|
|
|
45
45
|
|
|
46
46
|
### 2. Build the EscrowClient
|
|
47
47
|
|
|
48
|
-
It needs the swap client plus
|
|
48
|
+
It needs the swap client plus Arkade providers and repositories. Create one for the
|
|
49
49
|
lifetime of your app.
|
|
50
50
|
|
|
51
51
|
```ts
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
} from "@arkade-os/sdk";
|
|
59
59
|
import { EscrowClient } from "@satora/escrow-client";
|
|
60
60
|
|
|
61
|
-
const ARK_URL = "https://master.arkade.sh"; // the
|
|
61
|
+
const ARK_URL = "https://master.arkade.sh"; // the Arkade server (serves Arkade + indexer)
|
|
62
62
|
|
|
63
63
|
const arkProvider = new RestArkProvider(ARK_URL);
|
|
64
64
|
const indexerProvider = new RestIndexerProvider(ARK_URL);
|
|
@@ -71,7 +71,7 @@ const escrowClient = await EscrowClient.create({
|
|
|
71
71
|
walletRepository: new InMemoryWalletRepository(),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
// Resolve the network from the
|
|
74
|
+
// Resolve the network from the Arkade server (used for address derivation below).
|
|
75
75
|
const info = await arkProvider.getInfo();
|
|
76
76
|
const network = networks[info.network as keyof typeof networks];
|
|
77
77
|
```
|
|
@@ -82,7 +82,7 @@ const network = networks[info.network as keyof typeof networks];
|
|
|
82
82
|
## Fund an escrow from Lightning
|
|
83
83
|
|
|
84
84
|
Describe the escrow you want to fund as `EscrowScriptOptions` (x-only 32-byte
|
|
85
|
-
pubkeys; `exitTimelock` is the
|
|
85
|
+
pubkeys; `exitTimelock` is the Arkade server-mandated CSV). `fundFromLightning` derives the
|
|
86
86
|
escrow address, starts watching it, and creates a Lightning→Arkade swap whose
|
|
87
87
|
payout claims into that escrow.
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ import type { EscrowScriptOptions } from "@satora/escrow-client"; // re-exported
|
|
|
92
92
|
const escrow: EscrowScriptOptions = {
|
|
93
93
|
sellerPubKey, // Uint8Array(32)
|
|
94
94
|
arbiterPubKey, // Uint8Array(32)
|
|
95
|
-
|
|
95
|
+
arkadeServerPubKey, // Uint8Array(32) — the Arkade server's signer pubkey
|
|
96
96
|
exitTimelock: {type: "blocks", value: 144n},
|
|
97
97
|
};
|
|
98
98
|
|
|
@@ -193,7 +193,7 @@ const settlementTxid = await escrowClient.withdrawToL1({
|
|
|
193
193
|
|
|
194
194
|
### To another Arkade address
|
|
195
195
|
|
|
196
|
-
A plain offchain
|
|
196
|
+
A plain offchain Arkade transfer — the funds stay on Arkade, so it's the cheapest and
|
|
197
197
|
fastest withdrawal (no swap, no settlement round):
|
|
198
198
|
|
|
199
199
|
```ts
|
|
@@ -213,7 +213,7 @@ import:
|
|
|
213
213
|
```ts
|
|
214
214
|
import {
|
|
215
215
|
EscrowVtxoScript, // 2-of-2 escrow VtxoScript
|
|
216
|
-
buildEscrowReleaseTx, // build the cooperative release
|
|
216
|
+
buildEscrowReleaseTx, // build the cooperative release Arkade transaction
|
|
217
217
|
signEscrowArkTx, // sign a release as a co-party
|
|
218
218
|
verifyReleaseArkTx, // verify a release pays the agreed outputs
|
|
219
219
|
} from "@satora/escrow-client";
|
|
@@ -238,6 +238,6 @@ escrowClient.dispose(); // stop watching, clear listeners
|
|
|
238
238
|
| `quoteLightningWithdrawal(sourceAmountSats)` | `{ recipientSats, sourceSats }` — recipient amount after the swap fee. |
|
|
239
239
|
| `withdrawToLightning({ wallet, destination, amountSats? })` | Withdraw the payout to a BOLT11 / LNURL / Lightning address. |
|
|
240
240
|
| `withdrawToL1({ wallet, destinationAddress, amountSats? })` | Withdraw the payout onchain via collaborative offboard. |
|
|
241
|
-
| `withdrawToArkade({ wallet, destinationAddress, amountSats })` | Withdraw the payout to another Arkade address (offchain
|
|
241
|
+
| `withdrawToArkade({ wallet, destinationAddress, amountSats })` | Withdraw the payout to another Arkade address (offchain Arkade transfer). |
|
|
242
242
|
| `escrowMonitor` | The underlying `EscrowMonitor`. |
|
|
243
243
|
| `dispose()` | Release monitor resources. |
|
package/dist/escrow-client.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type SwapClient = Pick<Client, "createLightningToArkadeSwap" | "claimArka
|
|
|
22
22
|
export interface EscrowClientConfig {
|
|
23
23
|
/** The consumer's swap client (see {@link SwapClient}). */
|
|
24
24
|
swap: SwapClient;
|
|
25
|
-
/**
|
|
25
|
+
/** Arkade server provider (for fees + release submission). */
|
|
26
26
|
arkProvider: ArkProvider;
|
|
27
27
|
/** Indexer provider used to watch escrow addresses. */
|
|
28
28
|
indexerProvider: IndexerProvider;
|
|
@@ -34,7 +34,7 @@ export interface EscrowClientConfig {
|
|
|
34
34
|
/**
|
|
35
35
|
* Result of {@link EscrowClient.withdraw}, discriminated by `method`. `txid` is
|
|
36
36
|
* present on every branch — the VHTLC funding txid (lightning), the offboard
|
|
37
|
-
* settlement txid (l1), or the
|
|
37
|
+
* settlement txid (l1), or the Arkade transfer txid (arkade).
|
|
38
38
|
*/
|
|
39
39
|
export type WithdrawResult = {
|
|
40
40
|
method: "lightning";
|
|
@@ -61,7 +61,7 @@ export interface FundFromLightningHandle {
|
|
|
61
61
|
swapId: string;
|
|
62
62
|
/** BOLT11 invoice the funder pays to start the LN→escrow swap. */
|
|
63
63
|
invoice: string;
|
|
64
|
-
/** The escrow
|
|
64
|
+
/** The escrow Arkade address being funded. */
|
|
65
65
|
escrowAddress: string;
|
|
66
66
|
/**
|
|
67
67
|
* Call after the invoice has been paid. Claims the server-funded VHTLC into
|
|
@@ -155,9 +155,9 @@ export declare class EscrowClient {
|
|
|
155
155
|
amountSats?: bigint;
|
|
156
156
|
}): Promise<string>;
|
|
157
157
|
/**
|
|
158
|
-
* Withdraw a released payout to another Arkade address — a plain offchain
|
|
159
|
-
* transfer. The funds stay on
|
|
160
|
-
* the cheapest, fastest withdrawal. Returns the
|
|
158
|
+
* Withdraw a released payout to another Arkade address — a plain offchain Arkade
|
|
159
|
+
* transfer. The funds stay on Arkade (no swap, no settlement round), so this is
|
|
160
|
+
* the cheapest, fastest withdrawal. Returns the Arkade transaction ID.
|
|
161
161
|
*
|
|
162
162
|
* The buyer holds the released payout as a normal VTXO at their wallet's
|
|
163
163
|
* address, so this is a plain send — no escrow-specific signing.
|
|
@@ -176,7 +176,7 @@ export declare class EscrowClient {
|
|
|
176
176
|
* {@link withdrawToArkade}, or {@link withdrawToL1}.
|
|
177
177
|
*
|
|
178
178
|
* - BOLT11 invoice / LNURL / Lightning address → Lightning
|
|
179
|
-
* - Arkade address (`ark1…` / `tark1…`) → offchain
|
|
179
|
+
* - Arkade address (`ark1…` / `tark1…`) → offchain Arkade transfer
|
|
180
180
|
* - anything else (a Bitcoin address) → L1 offboard
|
|
181
181
|
*
|
|
182
182
|
* `amountSats` is **required** for an Arkade address and for a Lightning
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow-client.d.ts","sourceRoot":"","sources":["../src/escrow-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KA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).offboard(params.destinationAddress, fees, params.amountSats);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* Withdraw a released payout to another Arkade address — a plain offchain
|
|
138
|
-
* transfer. The funds stay on
|
|
139
|
-
* the cheapest, fastest withdrawal. Returns the
|
|
137
|
+
* Withdraw a released payout to another Arkade address — a plain offchain Arkade
|
|
138
|
+
* transfer. The funds stay on Arkade (no swap, no settlement round), so this is
|
|
139
|
+
* the cheapest, fastest withdrawal. Returns the Arkade transaction ID.
|
|
140
140
|
*
|
|
141
141
|
* The buyer holds the released payout as a normal VTXO at their wallet's
|
|
142
142
|
* address, so this is a plain send — no escrow-specific signing.
|
|
@@ -153,7 +153,7 @@ export class EscrowClient {
|
|
|
153
153
|
* {@link withdrawToArkade}, or {@link withdrawToL1}.
|
|
154
154
|
*
|
|
155
155
|
* - BOLT11 invoice / LNURL / Lightning address → Lightning
|
|
156
|
-
* - Arkade address (`ark1…` / `tark1…`) → offchain
|
|
156
|
+
* - Arkade address (`ark1…` / `tark1…`) → offchain Arkade transfer
|
|
157
157
|
* - anything else (a Bitcoin address) → L1 offboard
|
|
158
158
|
*
|
|
159
159
|
* `amountSats` is **required** for an Arkade address and for a Lightning
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@satora/escrow-client",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "High-level escrow flows (funding/withdrawing) bundling @satora/escrow with an injected swap client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@scure/base": "^2.0.0",
|
|
20
|
-
"@satora/escrow": "0.0.1
|
|
20
|
+
"@satora/escrow": "0.0.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@arkade-os/sdk": "^0.4.32",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@biomejs/biome": "2.3.15",
|
|
29
29
|
"typescript": "^5.7.0",
|
|
30
30
|
"vitest": "^3.0.0",
|
|
31
|
-
"@satora/swap": "0.0.1
|
|
31
|
+
"@satora/swap": "0.0.1"
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"publishConfig": {
|