@arkade-os/swap 0.1.0-rc.3 → 0.1.0-rc.30
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 +35 -4
- package/dist/advanced.cjs +6390 -3002
- package/dist/advanced.d.cts +391 -281
- package/dist/advanced.d.ts +391 -281
- package/dist/advanced.js +444 -26
- package/dist/chunk-7V254T53.js +3384 -0
- package/dist/chunk-A3SHHRX4.js +104 -0
- package/dist/chunk-AEYSMVWU.js +3021 -0
- package/dist/{chunk-H5KFNL5O.js → chunk-KIXAIAUC.js} +1596 -609
- package/dist/index.cjs +6797 -3666
- package/dist/index.d.cts +71 -185
- package/dist/index.d.ts +71 -185
- package/dist/index.js +146 -47
- package/dist/lockupContract-D7NyiHpE.d.ts +144 -0
- package/dist/lockupContract-VzLVZPcw.d.cts +144 -0
- package/dist/node/index.cjs +61 -10
- package/dist/node/index.d.cts +316 -615
- package/dist/node/index.d.ts +316 -615
- package/dist/node/index.js +65 -10
- package/dist/nostr.cjs +504 -52
- package/dist/nostr.d.cts +59 -70
- package/dist/nostr.d.ts +59 -70
- package/dist/nostr.js +268 -36
- package/dist/offer-CSMhR5sj.d.cts +269 -0
- package/dist/offer-CVnYFj7r.d.ts +269 -0
- package/dist/offerFillPlan-D-krqw0z.d.cts +1641 -0
- package/dist/offerFillPlan-D4Oy5_yZ.d.ts +1641 -0
- package/dist/protocol.cjs +5350 -3699
- package/dist/protocol.d.cts +211 -679
- package/dist/protocol.d.ts +211 -679
- package/dist/protocol.js +212 -226
- package/dist/repositories/realm/index.cjs +55 -11
- package/dist/repositories/realm/index.d.cts +18 -30
- package/dist/repositories/realm/index.d.ts +18 -30
- package/dist/repositories/realm/index.js +49 -12
- package/dist/repositories/sqlite/index.cjs +61 -10
- package/dist/repositories/sqlite/index.d.cts +7 -6
- package/dist/repositories/sqlite/index.d.ts +7 -6
- package/dist/repositories/sqlite/index.js +57 -11
- package/dist/repository-DRlPgbU8.d.cts +2341 -0
- package/dist/repository-rbPbJplG.d.ts +2341 -0
- package/dist/rfq-BJ8SC_Gp.d.cts +978 -0
- package/dist/rfq-BJ8SC_Gp.d.ts +978 -0
- package/dist/watch-CeVD4WnY.d.cts +74 -0
- package/dist/watch-CrVtt1pC.d.ts +74 -0
- package/package.json +12 -12
- package/dist/chunk-LYCMM3VB.js +0 -1357
- package/dist/chunk-OROIHWXD.js +0 -3162
- package/dist/chunk-U7VWWTL6.js +0 -66
- package/dist/errors-CcvUMXEF.d.cts +0 -2197
- package/dist/errors-Cwz3Xh72.d.ts +0 -2197
- package/dist/lockupContract-BvfhGH62.d.cts +0 -108
- package/dist/lockupContract-BvfhGH62.d.ts +0 -108
- package/dist/repository-B8MJY64N.d.cts +0 -3452
- package/dist/repository-BGlWfv3c.d.ts +0 -3452
- package/dist/rfq-CSgBQkjl.d.cts +0 -1099
- package/dist/rfq-CSgBQkjl.d.ts +0 -1099
- package/dist/watch-BjMc3SFo.d.cts +0 -96
- package/dist/watch-DkbPNiqf.d.ts +0 -96
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { VHTLC, IContractManager } from '@arkade-os/sdk';
|
|
2
|
-
|
|
3
|
-
/** The contract type a swap lockup registers under. `@arkade-os/sdk`'s handler
|
|
4
|
-
* for `VHTLC.ScriptV2` — the covenant script this corridor builds.
|
|
5
|
-
*
|
|
6
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
7
|
-
*/
|
|
8
|
-
declare const SWAP_LOCKUP_CONTRACT_TYPE = "vhtlc-v2";
|
|
9
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
10
|
-
declare const SWAP_LOCKUP_CONTRACT_LABEL = "Arkade RFQ swap lockup";
|
|
11
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
12
|
-
declare const SWAP_LOCKUP_CONTRACT_KIND = "rfq-swap-lockup";
|
|
13
|
-
/** The write seam registration needs, narrowed to the one method — the same
|
|
14
|
-
* injection style as `SwapContractRegistry`, and satisfied by a real
|
|
15
|
-
* `ContractManager` (`await wallet.getContractManager()`).
|
|
16
|
-
*
|
|
17
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
18
|
-
*/
|
|
19
|
-
type LockupContractWriter = Pick<IContractManager, "createContract">;
|
|
20
|
-
/** The read seam {@link lockupContractParams} needs. Same narrowing, same
|
|
21
|
-
* `ContractManager` satisfies it.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
24
|
-
*/
|
|
25
|
-
type LockupContractReader = Pick<IContractManager, "getContracts">;
|
|
26
|
-
/**
|
|
27
|
-
* No row for a lockup a record claims was funded.
|
|
28
|
-
*
|
|
29
|
-
* Separate from a rebuild failure on purpose: the record is fine and its money
|
|
30
|
-
* may well be at the address — what is missing is the wallet's copy of the
|
|
31
|
-
* covenant, which registration writes before the address can be funded. So this
|
|
32
|
-
* means the contract store was cleared or was never the one that registered
|
|
33
|
-
* this swap, and the remedy is a store, not a re-quote.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
36
|
-
*/
|
|
37
|
-
declare class LockupContractMissing extends Error {
|
|
38
|
-
/** The lockup whose row is absent. */
|
|
39
|
-
readonly address: string;
|
|
40
|
-
/** Its pkScript hex — the key the row would have been under. */
|
|
41
|
-
readonly script: string;
|
|
42
|
-
constructor(address: string, script: string);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The lockup could not be written locally.
|
|
46
|
-
*
|
|
47
|
-
* Deliberately NOT a {@link SwapRefusal} or an {@link AddressMismatch}: those
|
|
48
|
-
* say "the quote is bad, never fund it", while this says "the quote is fine and
|
|
49
|
-
* your own store failed".
|
|
50
|
-
*
|
|
51
|
-
* The throw is the safe point: nothing is funded, and on the receive legs the
|
|
52
|
-
* invoice never left the function, so the abandoned quote is inert and simply
|
|
53
|
-
* retrying the request is the recovery. `script` travels beside `address` so a
|
|
54
|
-
* caller that still holds the swap — `RfqSwapManager`'s `ensureRegistered`, or
|
|
55
|
-
* one resuming from its own record — can retry `registerLockupContract` alone
|
|
56
|
-
* instead of re-quoting. It is NOT enough to resume a request that threw here:
|
|
57
|
-
* that caller never received the invoice or `secrets`.
|
|
58
|
-
*
|
|
59
|
-
* A root export because `client.accept()` throws it: a caller catching that
|
|
60
|
-
* refusal names this class.
|
|
61
|
-
*/
|
|
62
|
-
declare class LockupRegistrationFailed extends Error {
|
|
63
|
-
/** The lockup address that was never registered — never fund it: nothing
|
|
64
|
-
* is watching it. */
|
|
65
|
-
readonly address: string;
|
|
66
|
-
/** The covenant the row would have been written from — the other half of
|
|
67
|
-
* `registerLockupContract`, so the write is retryable without a quote. */
|
|
68
|
-
readonly script: InstanceType<typeof VHTLC.ScriptV2>;
|
|
69
|
-
constructor(script: InstanceType<typeof VHTLC.ScriptV2>, address: string, cause: unknown);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Register a lockup covenant so its VTXOs are watched, annotatable and — via
|
|
73
|
-
* `vhtlc-v2`'s own handler, which is never generically spendable — kept out of
|
|
74
|
-
* ordinary coin selection.
|
|
75
|
-
*
|
|
76
|
-
* The row carries script-level facts only. Per-swap identity and key material
|
|
77
|
-
* stay in the swap record: rows are keyed by script and first-writer-wins, so
|
|
78
|
-
* anything per-swap written here is stale from the second swap onward.
|
|
79
|
-
*
|
|
80
|
-
* Takes the derived script rather than a script hex plus params, so the row
|
|
81
|
-
* cannot describe a script other than the one it is keyed by.
|
|
82
|
-
*
|
|
83
|
-
* Throws {@link LockupRegistrationFailed}, so a caller can tell a local
|
|
84
|
-
* storage problem from a reason to walk away from the quote.
|
|
85
|
-
*
|
|
86
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
87
|
-
*/
|
|
88
|
-
declare function registerLockupContract(contracts: LockupContractWriter, script: InstanceType<typeof VHTLC.ScriptV2>, address: string): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* The stored covenant parameters of a funded lockup — the other half of
|
|
91
|
-
* `rebuildRfqSwap`.
|
|
92
|
-
*
|
|
93
|
-
* The row is the wallet's own copy of the tree, written from the covenant
|
|
94
|
-
* before the address could be funded and keyed by the script it derives, which
|
|
95
|
-
* `createContract` refuses to write unless the params reproduce it. That is why
|
|
96
|
-
* an RFQ swap record stores no tree parameters of its own.
|
|
97
|
-
*
|
|
98
|
-
* Looked up by script rather than address: the script is the row's key, and
|
|
99
|
-
* decoding it here means a record whose address does not decode fails as a bad
|
|
100
|
-
* address instead of as a missing row.
|
|
101
|
-
*
|
|
102
|
-
* Throws {@link LockupContractMissing} when there is no row.
|
|
103
|
-
*
|
|
104
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
105
|
-
*/
|
|
106
|
-
declare function lockupContractParams(contracts: LockupContractReader, lockupAddress: string): Promise<Record<string, string>>;
|
|
107
|
-
|
|
108
|
-
export { LockupRegistrationFailed as L, SWAP_LOCKUP_CONTRACT_KIND as S, LockupContractMissing as a, type LockupContractReader as b, type LockupContractWriter as c, SWAP_LOCKUP_CONTRACT_LABEL as d, SWAP_LOCKUP_CONTRACT_TYPE as e, lockupContractParams as l, registerLockupContract as r };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { VHTLC, IContractManager } from '@arkade-os/sdk';
|
|
2
|
-
|
|
3
|
-
/** The contract type a swap lockup registers under. `@arkade-os/sdk`'s handler
|
|
4
|
-
* for `VHTLC.ScriptV2` — the covenant script this corridor builds.
|
|
5
|
-
*
|
|
6
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
7
|
-
*/
|
|
8
|
-
declare const SWAP_LOCKUP_CONTRACT_TYPE = "vhtlc-v2";
|
|
9
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
10
|
-
declare const SWAP_LOCKUP_CONTRACT_LABEL = "Arkade RFQ swap lockup";
|
|
11
|
-
/** @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`. */
|
|
12
|
-
declare const SWAP_LOCKUP_CONTRACT_KIND = "rfq-swap-lockup";
|
|
13
|
-
/** The write seam registration needs, narrowed to the one method — the same
|
|
14
|
-
* injection style as `SwapContractRegistry`, and satisfied by a real
|
|
15
|
-
* `ContractManager` (`await wallet.getContractManager()`).
|
|
16
|
-
*
|
|
17
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
18
|
-
*/
|
|
19
|
-
type LockupContractWriter = Pick<IContractManager, "createContract">;
|
|
20
|
-
/** The read seam {@link lockupContractParams} needs. Same narrowing, same
|
|
21
|
-
* `ContractManager` satisfies it.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
24
|
-
*/
|
|
25
|
-
type LockupContractReader = Pick<IContractManager, "getContracts">;
|
|
26
|
-
/**
|
|
27
|
-
* No row for a lockup a record claims was funded.
|
|
28
|
-
*
|
|
29
|
-
* Separate from a rebuild failure on purpose: the record is fine and its money
|
|
30
|
-
* may well be at the address — what is missing is the wallet's copy of the
|
|
31
|
-
* covenant, which registration writes before the address can be funded. So this
|
|
32
|
-
* means the contract store was cleared or was never the one that registered
|
|
33
|
-
* this swap, and the remedy is a store, not a re-quote.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
36
|
-
*/
|
|
37
|
-
declare class LockupContractMissing extends Error {
|
|
38
|
-
/** The lockup whose row is absent. */
|
|
39
|
-
readonly address: string;
|
|
40
|
-
/** Its pkScript hex — the key the row would have been under. */
|
|
41
|
-
readonly script: string;
|
|
42
|
-
constructor(address: string, script: string);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The lockup could not be written locally.
|
|
46
|
-
*
|
|
47
|
-
* Deliberately NOT a {@link SwapRefusal} or an {@link AddressMismatch}: those
|
|
48
|
-
* say "the quote is bad, never fund it", while this says "the quote is fine and
|
|
49
|
-
* your own store failed".
|
|
50
|
-
*
|
|
51
|
-
* The throw is the safe point: nothing is funded, and on the receive legs the
|
|
52
|
-
* invoice never left the function, so the abandoned quote is inert and simply
|
|
53
|
-
* retrying the request is the recovery. `script` travels beside `address` so a
|
|
54
|
-
* caller that still holds the swap — `RfqSwapManager`'s `ensureRegistered`, or
|
|
55
|
-
* one resuming from its own record — can retry `registerLockupContract` alone
|
|
56
|
-
* instead of re-quoting. It is NOT enough to resume a request that threw here:
|
|
57
|
-
* that caller never received the invoice or `secrets`.
|
|
58
|
-
*
|
|
59
|
-
* A root export because `client.accept()` throws it: a caller catching that
|
|
60
|
-
* refusal names this class.
|
|
61
|
-
*/
|
|
62
|
-
declare class LockupRegistrationFailed extends Error {
|
|
63
|
-
/** The lockup address that was never registered — never fund it: nothing
|
|
64
|
-
* is watching it. */
|
|
65
|
-
readonly address: string;
|
|
66
|
-
/** The covenant the row would have been written from — the other half of
|
|
67
|
-
* `registerLockupContract`, so the write is retryable without a quote. */
|
|
68
|
-
readonly script: InstanceType<typeof VHTLC.ScriptV2>;
|
|
69
|
-
constructor(script: InstanceType<typeof VHTLC.ScriptV2>, address: string, cause: unknown);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Register a lockup covenant so its VTXOs are watched, annotatable and — via
|
|
73
|
-
* `vhtlc-v2`'s own handler, which is never generically spendable — kept out of
|
|
74
|
-
* ordinary coin selection.
|
|
75
|
-
*
|
|
76
|
-
* The row carries script-level facts only. Per-swap identity and key material
|
|
77
|
-
* stay in the swap record: rows are keyed by script and first-writer-wins, so
|
|
78
|
-
* anything per-swap written here is stale from the second swap onward.
|
|
79
|
-
*
|
|
80
|
-
* Takes the derived script rather than a script hex plus params, so the row
|
|
81
|
-
* cannot describe a script other than the one it is keyed by.
|
|
82
|
-
*
|
|
83
|
-
* Throws {@link LockupRegistrationFailed}, so a caller can tell a local
|
|
84
|
-
* storage problem from a reason to walk away from the quote.
|
|
85
|
-
*
|
|
86
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
87
|
-
*/
|
|
88
|
-
declare function registerLockupContract(contracts: LockupContractWriter, script: InstanceType<typeof VHTLC.ScriptV2>, address: string): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* The stored covenant parameters of a funded lockup — the other half of
|
|
91
|
-
* `rebuildRfqSwap`.
|
|
92
|
-
*
|
|
93
|
-
* The row is the wallet's own copy of the tree, written from the covenant
|
|
94
|
-
* before the address could be funded and keyed by the script it derives, which
|
|
95
|
-
* `createContract` refuses to write unless the params reproduce it. That is why
|
|
96
|
-
* an RFQ swap record stores no tree parameters of its own.
|
|
97
|
-
*
|
|
98
|
-
* Looked up by script rather than address: the script is the row's key, and
|
|
99
|
-
* decoding it here means a record whose address does not decode fails as a bad
|
|
100
|
-
* address instead of as a missing row.
|
|
101
|
-
*
|
|
102
|
-
* Throws {@link LockupContractMissing} when there is no row.
|
|
103
|
-
*
|
|
104
|
-
* @deprecated Lockup registration is internal to `accept()`; no replacement. Moved off the package root to `@arkade-os/swap/protocol`.
|
|
105
|
-
*/
|
|
106
|
-
declare function lockupContractParams(contracts: LockupContractReader, lockupAddress: string): Promise<Record<string, string>>;
|
|
107
|
-
|
|
108
|
-
export { LockupRegistrationFailed as L, SWAP_LOCKUP_CONTRACT_KIND as S, LockupContractMissing as a, type LockupContractReader as b, type LockupContractWriter as c, SWAP_LOCKUP_CONTRACT_LABEL as d, SWAP_LOCKUP_CONTRACT_TYPE as e, lockupContractParams as l, registerLockupContract as r };
|