@satora/escrow-client 0.0.1-alpha.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/dist/escrow-client.d.ts +120 -0
- package/dist/escrow-client.d.ts.map +1 -0
- package/dist/escrow-client.js +129 -0
- package/dist/escrow-client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type ArkProvider, type ContractRepository, type IndexerProvider, type IWallet, type Network, type WalletRepository } from "@arkade-os/sdk";
|
|
2
|
+
import { type EscrowFundedEvent, EscrowMonitor, type EscrowScriptOptions } from "@satora/escrow";
|
|
3
|
+
import type { Client } from "@satora/swap";
|
|
4
|
+
/**
|
|
5
|
+
* The swap-client surface EscrowClient depends on — just the methods it calls,
|
|
6
|
+
* picked from `@satora/swap`'s `Client`.
|
|
7
|
+
*
|
|
8
|
+
* Narrowing to a structural subset (rather than the whole `Client` class) keeps
|
|
9
|
+
* the dependency minimal and lets any compatible client be injected, even one
|
|
10
|
+
* resolved from a different physical copy of the swap SDK (the `Client` class
|
|
11
|
+
* has private fields, so the full class would be a nominal mismatch across
|
|
12
|
+
* copies).
|
|
13
|
+
*/
|
|
14
|
+
export type SwapClient = Pick<Client, "createLightningToArkadeSwap" | "claimArkade" | "createArkadeToLightningSwap">;
|
|
15
|
+
/**
|
|
16
|
+
* Dependencies for {@link EscrowClient}.
|
|
17
|
+
*
|
|
18
|
+
* The swap client is **injected** — escrow-client never imports the swap SDK
|
|
19
|
+
* at runtime (only its type), so it carries none of that bundle's weight.
|
|
20
|
+
* Consumers (e.g. Peach) already run a swap client; this reuses it.
|
|
21
|
+
*/
|
|
22
|
+
export interface EscrowClientConfig {
|
|
23
|
+
/** The consumer's swap client (see {@link SwapClient}). */
|
|
24
|
+
swap: SwapClient;
|
|
25
|
+
/** ASP provider (for fees + release submission). */
|
|
26
|
+
arkProvider: ArkProvider;
|
|
27
|
+
/** Indexer provider used to watch escrow addresses. */
|
|
28
|
+
indexerProvider: IndexerProvider;
|
|
29
|
+
/** Contract repository for the escrow monitor. */
|
|
30
|
+
contractRepository: ContractRepository;
|
|
31
|
+
/** Wallet repository (vtxo storage) for the escrow monitor. */
|
|
32
|
+
walletRepository: WalletRepository;
|
|
33
|
+
}
|
|
34
|
+
export interface FundFromLightningParams {
|
|
35
|
+
/** The escrow to fund (script params, used to derive the address + watch). */
|
|
36
|
+
escrow: EscrowScriptOptions;
|
|
37
|
+
/** Network for address derivation. */
|
|
38
|
+
network: Network;
|
|
39
|
+
/** Sats to receive at the escrow (the LN→Arkade swap target amount). */
|
|
40
|
+
amountSats: number;
|
|
41
|
+
}
|
|
42
|
+
export interface FundFromLightningHandle {
|
|
43
|
+
/** Lendaswap swap id. */
|
|
44
|
+
swapId: string;
|
|
45
|
+
/** BOLT11 invoice the funder pays to start the LN→escrow swap. */
|
|
46
|
+
invoice: string;
|
|
47
|
+
/** The escrow Ark address being funded. */
|
|
48
|
+
escrowAddress: string;
|
|
49
|
+
/**
|
|
50
|
+
* Call after the invoice has been paid. Claims the server-funded VHTLC into
|
|
51
|
+
* the escrow address and resolves once the escrow VTXO is observed by the
|
|
52
|
+
* monitor. Rejects on timeout.
|
|
53
|
+
*/
|
|
54
|
+
awaitFunded(timeoutMs?: number): Promise<EscrowFundedEvent>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* High-level escrow flows that bundle the swap on/off-ramp with the escrow
|
|
58
|
+
* monitor: fund an escrow from Lightning, and withdraw a released payout to
|
|
59
|
+
* Lightning or L1.
|
|
60
|
+
*
|
|
61
|
+
* The swap client is injected (see {@link EscrowClientConfig}). All escrow
|
|
62
|
+
* primitives are re-exported from the package root, so a consumer needs only
|
|
63
|
+
* `@satora/escrow-client` plus the swap `Client` it already runs.
|
|
64
|
+
*/
|
|
65
|
+
export declare class EscrowClient {
|
|
66
|
+
private readonly swap;
|
|
67
|
+
private readonly arkProvider;
|
|
68
|
+
private readonly monitor;
|
|
69
|
+
private constructor();
|
|
70
|
+
static create(config: EscrowClientConfig): Promise<EscrowClient>;
|
|
71
|
+
/** The underlying escrow monitor (onFunded/onReleased, watch, listEscrows). */
|
|
72
|
+
get escrowMonitor(): EscrowMonitor;
|
|
73
|
+
/**
|
|
74
|
+
* Fund an escrow from Lightning.
|
|
75
|
+
*
|
|
76
|
+
* Creates a Lightning→Arkade swap whose payout claims into the escrow
|
|
77
|
+
* address, and starts watching the escrow. Returns the invoice to pay plus
|
|
78
|
+
* `awaitFunded()`, which — after the invoice is paid — claims the
|
|
79
|
+
* server-funded VHTLC into the escrow and resolves when the VTXO lands.
|
|
80
|
+
*/
|
|
81
|
+
fundFromLightning(params: FundFromLightningParams): Promise<FundFromLightningHandle>;
|
|
82
|
+
/**
|
|
83
|
+
* Withdraw a released payout to Lightning via an Arkade→Lightning swap.
|
|
84
|
+
*
|
|
85
|
+
* Creates the swap for `lightningInvoice` and funds its VHTLC from the buyer
|
|
86
|
+
* wallet's payout. The Lendaswap server then claims the VHTLC and pays the
|
|
87
|
+
* invoice. Returns the swap id, the VHTLC funding txid, and the sats sent
|
|
88
|
+
* (the invoice amount plus the swap fee — must be <= the available payout).
|
|
89
|
+
*/
|
|
90
|
+
withdrawToLightning(params: {
|
|
91
|
+
/** Buyer wallet holding the released payout VTXO(s). */
|
|
92
|
+
wallet: IWallet;
|
|
93
|
+
/** BOLT11 invoice to be paid by the swap server. */
|
|
94
|
+
lightningInvoice: string;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
swapId: string;
|
|
97
|
+
fundingTxid: string;
|
|
98
|
+
sourceAmountSats: number;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Withdraw a released payout to L1 (a collaborative Arkade offboard).
|
|
102
|
+
*
|
|
103
|
+
* Redeems the buyer wallet's virtual outputs to an onchain address via a
|
|
104
|
+
* settlement round (`Ramps.offboard`). Returns the settlement txid.
|
|
105
|
+
*
|
|
106
|
+
* The buyer holds the released payout as a normal VTXO at their wallet's
|
|
107
|
+
* address, so this is a plain offboard — no escrow-specific signing.
|
|
108
|
+
*/
|
|
109
|
+
withdrawToL1(params: {
|
|
110
|
+
/** Buyer wallet holding the released payout VTXO(s). */
|
|
111
|
+
wallet: IWallet;
|
|
112
|
+
/** Destination onchain (L1) address. */
|
|
113
|
+
destinationAddress: string;
|
|
114
|
+
/** Amount to offboard in sats; omit to offboard everything. */
|
|
115
|
+
amountSats?: bigint;
|
|
116
|
+
}): Promise<string>;
|
|
117
|
+
/** Release the monitor's resources (stop watching, clear listeners). */
|
|
118
|
+
dispose(): void;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=escrow-client.d.ts.map
|
|
@@ -0,0 +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,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,iBAAiB,EACtB,aAAa,EACb,KAAK,mBAAmB,EAEzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,MAAM,EACN,6BAA6B,GAAG,aAAa,GAAG,6BAA6B,CAC9E,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,IAAI,EAAE,UAAU,CAAC;IACjB,oDAAoD;IACpD,WAAW,EAAE,WAAW,CAAC;IACzB,uDAAuD;IACvD,eAAe,EAAE,eAAe,CAAC;IACjC,kDAAkD;IAClD,kBAAkB,EAA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AE,OAAO,CAAC;QAChB,wCAAwC;QACxC,kBAAkB,EAAE,MAAM,CAAC;QAC3B,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,MAAM,CAAC;IASnB,wEAAwE;IACxE,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Ramps, } from "@arkade-os/sdk";
|
|
2
|
+
import { EscrowMonitor, EscrowVtxoScript, } from "@satora/escrow";
|
|
3
|
+
import { hex } from "@scure/base";
|
|
4
|
+
/**
|
|
5
|
+
* High-level escrow flows that bundle the swap on/off-ramp with the escrow
|
|
6
|
+
* monitor: fund an escrow from Lightning, and withdraw a released payout to
|
|
7
|
+
* Lightning or L1.
|
|
8
|
+
*
|
|
9
|
+
* The swap client is injected (see {@link EscrowClientConfig}). All escrow
|
|
10
|
+
* primitives are re-exported from the package root, so a consumer needs only
|
|
11
|
+
* `@satora/escrow-client` plus the swap `Client` it already runs.
|
|
12
|
+
*/
|
|
13
|
+
export class EscrowClient {
|
|
14
|
+
swap;
|
|
15
|
+
arkProvider;
|
|
16
|
+
monitor;
|
|
17
|
+
constructor(swap, arkProvider, monitor) {
|
|
18
|
+
this.swap = swap;
|
|
19
|
+
this.arkProvider = arkProvider;
|
|
20
|
+
this.monitor = monitor;
|
|
21
|
+
}
|
|
22
|
+
static async create(config) {
|
|
23
|
+
const monitor = await EscrowMonitor.create({
|
|
24
|
+
indexerProvider: config.indexerProvider,
|
|
25
|
+
contractRepository: config.contractRepository,
|
|
26
|
+
walletRepository: config.walletRepository,
|
|
27
|
+
});
|
|
28
|
+
return new EscrowClient(config.swap, config.arkProvider, monitor);
|
|
29
|
+
}
|
|
30
|
+
/** The underlying escrow monitor (onFunded/onReleased, watch, listEscrows). */
|
|
31
|
+
get escrowMonitor() {
|
|
32
|
+
return this.monitor;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fund an escrow from Lightning.
|
|
36
|
+
*
|
|
37
|
+
* Creates a Lightning→Arkade swap whose payout claims into the escrow
|
|
38
|
+
* address, and starts watching the escrow. Returns the invoice to pay plus
|
|
39
|
+
* `awaitFunded()`, which — after the invoice is paid — claims the
|
|
40
|
+
* server-funded VHTLC into the escrow and resolves when the VTXO lands.
|
|
41
|
+
*/
|
|
42
|
+
async fundFromLightning(params) {
|
|
43
|
+
const script = new EscrowVtxoScript(params.escrow);
|
|
44
|
+
const escrowAddress = script.arkAddress(params.network);
|
|
45
|
+
const escrowPkScript = hex.encode(script.pkScript);
|
|
46
|
+
// Watch the escrow so onFunded fires when the claim lands.
|
|
47
|
+
await this.monitor.watch(params.escrow, params.network);
|
|
48
|
+
const { response } = await this.swap.createLightningToArkadeSwap({
|
|
49
|
+
satsReceive: params.amountSats,
|
|
50
|
+
targetAddress: escrowAddress,
|
|
51
|
+
});
|
|
52
|
+
const awaitFunded = (timeoutMs = 120_000) => {
|
|
53
|
+
const funded = new Promise((resolve) => {
|
|
54
|
+
const unsubscribe = this.monitor.onFunded((event) => {
|
|
55
|
+
if (event.contract.script === escrowPkScript) {
|
|
56
|
+
unsubscribe();
|
|
57
|
+
resolve(event);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return (async () => {
|
|
62
|
+
// Claim the server-funded VHTLC into the escrow. waitForVtxoMs absorbs
|
|
63
|
+
// the lag between LN payment, server funding, and indexing.
|
|
64
|
+
const claim = await this.swap.claimArkade(response.id, {
|
|
65
|
+
destinationAddress: escrowAddress,
|
|
66
|
+
waitForVtxoMs: timeoutMs,
|
|
67
|
+
});
|
|
68
|
+
if (!claim.success) {
|
|
69
|
+
throw new Error(`claimArkade failed: ${claim.message}`);
|
|
70
|
+
}
|
|
71
|
+
return withTimeout(funded, timeoutMs, "escrow funding");
|
|
72
|
+
})();
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
swapId: response.id,
|
|
76
|
+
invoice: response.bolt11_invoice,
|
|
77
|
+
escrowAddress,
|
|
78
|
+
awaitFunded,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Withdraw a released payout to Lightning via an Arkade→Lightning swap.
|
|
83
|
+
*
|
|
84
|
+
* Creates the swap for `lightningInvoice` and funds its VHTLC from the buyer
|
|
85
|
+
* wallet's payout. The Lendaswap server then claims the VHTLC and pays the
|
|
86
|
+
* invoice. Returns the swap id, the VHTLC funding txid, and the sats sent
|
|
87
|
+
* (the invoice amount plus the swap fee — must be <= the available payout).
|
|
88
|
+
*/
|
|
89
|
+
async withdrawToLightning(params) {
|
|
90
|
+
const { response } = await this.swap.createArkadeToLightningSwap({
|
|
91
|
+
lightningInvoice: params.lightningInvoice,
|
|
92
|
+
});
|
|
93
|
+
// source_amount is serialized as a string over the wire.
|
|
94
|
+
const sourceAmountSats = Number(response.source_amount);
|
|
95
|
+
const fundingTxid = await params.wallet.send({
|
|
96
|
+
address: response.arkade_vhtlc_address,
|
|
97
|
+
amount: sourceAmountSats,
|
|
98
|
+
});
|
|
99
|
+
return { swapId: response.id, fundingTxid, sourceAmountSats };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Withdraw a released payout to L1 (a collaborative Arkade offboard).
|
|
103
|
+
*
|
|
104
|
+
* Redeems the buyer wallet's virtual outputs to an onchain address via a
|
|
105
|
+
* settlement round (`Ramps.offboard`). Returns the settlement txid.
|
|
106
|
+
*
|
|
107
|
+
* The buyer holds the released payout as a normal VTXO at their wallet's
|
|
108
|
+
* address, so this is a plain offboard — no escrow-specific signing.
|
|
109
|
+
*/
|
|
110
|
+
async withdrawToL1(params) {
|
|
111
|
+
const { fees } = await this.arkProvider.getInfo();
|
|
112
|
+
return new Ramps(params.wallet).offboard(params.destinationAddress, fees, params.amountSats);
|
|
113
|
+
}
|
|
114
|
+
/** Release the monitor's resources (stop watching, clear listeners). */
|
|
115
|
+
dispose() {
|
|
116
|
+
this.monitor.dispose();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function withTimeout(p, ms, label) {
|
|
120
|
+
let timer;
|
|
121
|
+
const timeout = new Promise((_, reject) => {
|
|
122
|
+
timer = setTimeout(() => reject(new Error(`timeout: ${label}`)), ms);
|
|
123
|
+
});
|
|
124
|
+
return Promise.race([p, timeout]).finally(() => {
|
|
125
|
+
if (timer)
|
|
126
|
+
clearTimeout(timer);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=escrow-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escrow-client.js","sourceRoot":"","sources":["../src/escrow-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAEN,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,aAAa,EAEb,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AA6DlC;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IACA;IAHnB,YACmB,IAAgB,EAChB,WAAwB,EACxB,OAAsB;QAFtB,SAAI,GAAJ,IAAI,CAAY;QAChB,gBAAW,GAAX,WAAW,CAAa;QACxB,YAAO,GAAP,OAAO,CAAe;IACtC,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAA0B;QAC5C,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC;YACzC,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,+EAA+E;IAC/E,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;;;OA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,OAAO,EAAE,CAAC;IACzB,CAAC;CACF;AAED,SAAS,WAAW,CAAI,CAAa,EAAE,EAAU,EAAE,KAAa;IAC9D,IAAI,KAAgD,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;QAC7C,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// One-stop import: re-export all escrow primitives so consumers need only
|
|
2
|
+
// `@satora/escrow-client` (plus the swap Client they already run).
|
|
3
|
+
export * from "@satora/escrow";
|
|
4
|
+
// High-level escrow flows (EscrowClient).
|
|
5
|
+
export * from "./escrow-client.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mEAAmE;AACnE,cAAc,gBAAgB,CAAC;AAC/B,0CAA0C;AAC1C,cAAc,oBAAoB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@satora/escrow-client",
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"description": "High-level escrow flows (funding/withdrawing) bundling @satora/escrow with an injected swap client",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@scure/base": "^2.0.0",
|
|
20
|
+
"@satora/escrow": "0.0.1-alpha.1"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@arkade-os/sdk": "^0.4.32",
|
|
24
|
+
"@satora/swap": "*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@arkade-os/sdk": "^0.4.32",
|
|
28
|
+
"@biomejs/biome": "2.3.15",
|
|
29
|
+
"typescript": "^5.7.0",
|
|
30
|
+
"@satora/swap": "0.0.1-alpha.1"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc -p tsconfig.build.json",
|
|
38
|
+
"check-types": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"lint": "biome check .",
|
|
40
|
+
"lint:fix": "biome check --write .",
|
|
41
|
+
"clean": "rm -rf dist"
|
|
42
|
+
}
|
|
43
|
+
}
|