@flop-labs/sdk 0.6.0 → 0.7.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/CHANGELOG.md +107 -0
- package/DIRECT_SWAP.md +422 -0
- package/DIRECT_SWAP_MAKER.md +239 -0
- package/README.md +18 -3
- package/dist/bundle/index.esm.js +1 -1
- package/dist/bundle/index.esm.js.map +1 -1
- package/dist/bundle/index.umd.cjs +1 -1
- package/dist/bundle/index.umd.cjs.map +1 -1
- package/dist/compute-channel/chain.d.ts.map +1 -1
- package/dist/compute-channel/chain.js +2 -1
- package/dist/compute-channel/chain.js.map +1 -1
- package/dist/compute-channel/direct-chat.d.ts +15 -0
- package/dist/compute-channel/direct-chat.d.ts.map +1 -0
- package/dist/compute-channel/direct-chat.js +73 -0
- package/dist/compute-channel/direct-chat.js.map +1 -0
- package/dist/compute-channel/direct-session-chain.d.ts.map +1 -1
- package/dist/compute-channel/direct-session-chain.js +54 -14
- package/dist/compute-channel/direct-session-chain.js.map +1 -1
- package/dist/compute-channel/direct-session-diagnostics.d.ts +22 -0
- package/dist/compute-channel/direct-session-diagnostics.d.ts.map +1 -0
- package/dist/compute-channel/direct-session-diagnostics.js +30 -0
- package/dist/compute-channel/direct-session-diagnostics.js.map +1 -0
- package/dist/compute-channel/direct-session.d.ts +37 -2
- package/dist/compute-channel/direct-session.d.ts.map +1 -1
- package/dist/compute-channel/direct-session.js +121 -30
- package/dist/compute-channel/direct-session.js.map +1 -1
- package/dist/compute-channel/index.d.ts +2 -0
- package/dist/compute-channel/index.d.ts.map +1 -1
- package/dist/compute-channel/index.js +2 -0
- package/dist/compute-channel/index.js.map +1 -1
- package/dist/compute-channel/miner-host.d.ts +9 -2
- package/dist/compute-channel/miner-host.d.ts.map +1 -1
- package/dist/compute-channel/miner-host.js +41 -5
- package/dist/compute-channel/miner-host.js.map +1 -1
- package/dist/compute-channel/model-config.d.ts +8 -2
- package/dist/compute-channel/model-config.d.ts.map +1 -1
- package/dist/compute-channel/model-config.js +251 -14
- package/dist/compute-channel/model-config.js.map +1 -1
- package/dist/compute-channel/offers.d.ts +7 -0
- package/dist/compute-channel/offers.d.ts.map +1 -1
- package/dist/compute-channel/offers.js +23 -2
- package/dist/compute-channel/offers.js.map +1 -1
- package/dist/compute-channel/session-prior-calibrations.d.ts +43 -0
- package/dist/compute-channel/session-prior-calibrations.d.ts.map +1 -0
- package/dist/compute-channel/session-prior-calibrations.js +53 -0
- package/dist/compute-channel/session-prior-calibrations.js.map +1 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts +11 -0
- package/dist/compute-channel/toploc-completion-rpc.d.ts.map +1 -1
- package/dist/compute-channel/toploc-completion-rpc.js +65 -2
- package/dist/compute-channel/toploc-completion-rpc.js.map +1 -1
- package/dist/compute-channel/toploc-completion.d.ts +34 -1
- package/dist/compute-channel/toploc-completion.d.ts.map +1 -1
- package/dist/compute-channel/toploc-completion.js +73 -8
- package/dist/compute-channel/toploc-completion.js.map +1 -1
- package/dist/compute-channel/watchtower/chain.d.ts +33 -0
- package/dist/compute-channel/watchtower/chain.d.ts.map +1 -0
- package/dist/compute-channel/watchtower/chain.js +168 -0
- package/dist/compute-channel/watchtower/chain.js.map +1 -0
- package/dist/compute-channel/watchtower/io.d.ts +38 -0
- package/dist/compute-channel/watchtower/io.d.ts.map +1 -0
- package/dist/compute-channel/watchtower/io.js +194 -0
- package/dist/compute-channel/watchtower/io.js.map +1 -0
- package/dist/compute-channel/watchtower/main.d.ts +3 -0
- package/dist/compute-channel/watchtower/main.d.ts.map +1 -0
- package/dist/compute-channel/watchtower/main.js +122 -0
- package/dist/compute-channel/watchtower/main.js.map +1 -0
- package/dist/compute-channel/watchtower/runner.d.ts +107 -0
- package/dist/compute-channel/watchtower/runner.d.ts.map +1 -0
- package/dist/compute-channel/watchtower/runner.js +266 -0
- package/dist/compute-channel/watchtower/runner.js.map +1 -0
- package/dist/direct-swap/chain.d.ts +65 -0
- package/dist/direct-swap/chain.d.ts.map +1 -0
- package/dist/direct-swap/chain.js +141 -0
- package/dist/direct-swap/chain.js.map +1 -0
- package/dist/direct-swap/core-node.d.ts +86 -0
- package/dist/direct-swap/core-node.d.ts.map +1 -0
- package/dist/direct-swap/core-node.js +383 -0
- package/dist/direct-swap/core-node.js.map +1 -0
- package/dist/direct-swap/index.d.ts +36 -0
- package/dist/direct-swap/index.d.ts.map +1 -0
- package/dist/direct-swap/index.js +21 -0
- package/dist/direct-swap/index.js.map +1 -0
- package/dist/direct-swap/lifecycle.d.ts +42 -0
- package/dist/direct-swap/lifecycle.d.ts.map +1 -0
- package/dist/direct-swap/lifecycle.js +81 -0
- package/dist/direct-swap/lifecycle.js.map +1 -0
- package/dist/direct-swap/maker-cli.d.ts +3 -0
- package/dist/direct-swap/maker-cli.d.ts.map +1 -0
- package/dist/direct-swap/maker-cli.js +71 -0
- package/dist/direct-swap/maker-cli.js.map +1 -0
- package/dist/direct-swap/maker-node.d.ts +132 -0
- package/dist/direct-swap/maker-node.d.ts.map +1 -0
- package/dist/direct-swap/maker-node.js +520 -0
- package/dist/direct-swap/maker-node.js.map +1 -0
- package/dist/direct-swap/observation.d.ts +8 -0
- package/dist/direct-swap/observation.d.ts.map +1 -0
- package/dist/direct-swap/observation.js +76 -0
- package/dist/direct-swap/observation.js.map +1 -0
- package/dist/direct-swap/planner.d.ts +32 -0
- package/dist/direct-swap/planner.d.ts.map +1 -0
- package/dist/direct-swap/planner.js +120 -0
- package/dist/direct-swap/planner.js.map +1 -0
- package/dist/direct-swap/protocol.d.ts +72 -0
- package/dist/direct-swap/protocol.d.ts.map +1 -0
- package/dist/direct-swap/protocol.js +97 -0
- package/dist/direct-swap/protocol.js.map +1 -0
- package/dist/direct-swap/recovery.d.ts +114 -0
- package/dist/direct-swap/recovery.d.ts.map +1 -0
- package/dist/direct-swap/recovery.js +190 -0
- package/dist/direct-swap/recovery.js.map +1 -0
- package/dist/direct-swap/registered-asset-manifest.d.ts +45 -0
- package/dist/direct-swap/registered-asset-manifest.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-manifest.js +51 -0
- package/dist/direct-swap/registered-asset-manifest.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-binding.d.ts +26 -0
- package/dist/direct-swap/registered-asset-v1-binding.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-binding.js +44 -0
- package/dist/direct-swap/registered-asset-v1-binding.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-codec.d.ts +74 -0
- package/dist/direct-swap/registered-asset-v1-codec.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-codec.js +101 -0
- package/dist/direct-swap/registered-asset-v1-codec.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-history.d.ts +18 -0
- package/dist/direct-swap/registered-asset-v1-history.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-history.js +102 -0
- package/dist/direct-swap/registered-asset-v1-history.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-inventory.d.ts +11 -0
- package/dist/direct-swap/registered-asset-v1-inventory.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-inventory.js +65 -0
- package/dist/direct-swap/registered-asset-v1-inventory.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-ledger.d.ts +15 -0
- package/dist/direct-swap/registered-asset-v1-ledger.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-ledger.js +69 -0
- package/dist/direct-swap/registered-asset-v1-ledger.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-lifecycle.d.ts +22 -0
- package/dist/direct-swap/registered-asset-v1-lifecycle.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-lifecycle.js +39 -0
- package/dist/direct-swap/registered-asset-v1-lifecycle.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-planner.d.ts +39 -0
- package/dist/direct-swap/registered-asset-v1-planner.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-planner.js +160 -0
- package/dist/direct-swap/registered-asset-v1-planner.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-recovery.d.ts +48 -0
- package/dist/direct-swap/registered-asset-v1-recovery.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-recovery.js +231 -0
- package/dist/direct-swap/registered-asset-v1-recovery.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1-source.d.ts +70 -0
- package/dist/direct-swap/registered-asset-v1-source.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1-source.js +206 -0
- package/dist/direct-swap/registered-asset-v1-source.js.map +1 -0
- package/dist/direct-swap/registered-asset-v1.d.ts +45 -0
- package/dist/direct-swap/registered-asset-v1.d.ts.map +1 -0
- package/dist/direct-swap/registered-asset-v1.js +184 -0
- package/dist/direct-swap/registered-asset-v1.js.map +1 -0
- package/dist/direct-swap/regtest.d.ts +14 -0
- package/dist/direct-swap/regtest.d.ts.map +1 -0
- package/dist/direct-swap/regtest.js +14 -0
- package/dist/direct-swap/regtest.js.map +1 -0
- package/dist/direct-swap/submission.d.ts +10 -0
- package/dist/direct-swap/submission.d.ts.map +1 -0
- package/dist/direct-swap/submission.js +65 -0
- package/dist/direct-swap/submission.js.map +1 -0
- package/dist/direct-swap/terms.d.ts +111 -0
- package/dist/direct-swap/terms.d.ts.map +1 -0
- package/dist/direct-swap/terms.js +131 -0
- package/dist/direct-swap/terms.js.map +1 -0
- package/dist/direct-swap/wallet.d.ts +13 -0
- package/dist/direct-swap/wallet.d.ts.map +1 -0
- package/dist/direct-swap/wallet.js +14 -0
- package/dist/direct-swap/wallet.js.map +1 -0
- package/dist/faucet.d.ts +1 -0
- package/dist/faucet.d.ts.map +1 -1
- package/dist/faucet.js +3 -1
- package/dist/faucet.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/model-loader/artifact-import.d.ts +16 -0
- package/dist/model-loader/artifact-import.d.ts.map +1 -0
- package/dist/model-loader/artifact-import.js +175 -0
- package/dist/model-loader/artifact-import.js.map +1 -0
- package/dist/model-loader/canonical.d.ts +1 -1
- package/dist/model-loader/canonical.js +1 -1
- package/dist/model-loader/dmverity.d.ts +3 -3
- package/dist/model-loader/dmverity.js +3 -3
- package/dist/model-loader/hf-preflight.d.ts +1 -1
- package/dist/model-loader/hf-preflight.d.ts.map +1 -1
- package/dist/model-loader/hf-preflight.js +1 -1
- package/dist/model-loader/hf-preflight.js.map +1 -1
- package/dist/model-loader/index.d.ts +1 -1
- package/dist/model-loader/index.js +1 -1
- package/dist/quickstart.d.ts +16 -12
- package/dist/quickstart.d.ts.map +1 -1
- package/dist/quickstart.js +53 -71
- package/dist/quickstart.js.map +1 -1
- package/dist/runtime-compatibility.d.ts +1 -1
- package/dist/runtime-compatibility.d.ts.map +1 -1
- package/dist/runtime-compatibility.js +8 -2
- package/dist/runtime-compatibility.js.map +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Direct BTC maker preparation
|
|
2
|
+
|
|
3
|
+
This Node-only reference process coordinates one operator's full-fill quotes,
|
|
4
|
+
signed commitments and durable reservations. It has no discovery, Technocore,
|
|
5
|
+
matcher or registered-relayer dependency. It is **disabled by default**.
|
|
6
|
+
|
|
7
|
+
Explicit `native-regtest` preparation keeps its existing behavior. Its instrument namespace
|
|
8
|
+
must be `native-rehearsal`, environment `local-rehearsal`, Bitcoin network `regtest`
|
|
9
|
+
and profile `regtest-p2sh-sha256-size32-height-cltv-v1`. It rejects all actual
|
|
10
|
+
voucher identities before signing. Native rehearsal does not establish voucher
|
|
11
|
+
issuance, backing, asset capability or a complete voucher/BTC trade.
|
|
12
|
+
|
|
13
|
+
The additive `registered-devnet` mode requires `registered: RegisteredAssetV1Source`
|
|
14
|
+
with actual local runtime/code/metadata/genesis qualification. Three earning sources
|
|
15
|
+
and their independent conversion identities stay separate; no economic defaults
|
|
16
|
+
or activation are supplied. Actual isolated trade qualification remains required.
|
|
17
|
+
|
|
18
|
+
## Run privately
|
|
19
|
+
|
|
20
|
+
After the workspace's normal SDK build, run:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
pnpm --filter @flop-labs/sdk exec node dist/direct-swap/maker-cli.js /absolute/operator-config.mjs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The published executable is `flop-direct-maker`. Its sole argument is a **local
|
|
27
|
+
operator-owned module**, whose default async factory returns `MakerOptions` from
|
|
28
|
+
`@flop-labs/sdk/direct-swap/maker-node`. That module owns the local signer and
|
|
29
|
+
independent wallet/chain adapters. Do not load a remote or counterparty-supplied
|
|
30
|
+
module. Do not expose stdin through an unauthenticated network service.
|
|
31
|
+
|
|
32
|
+
Configuration must explicitly supply the maker's three public keys, exact
|
|
33
|
+
`SwapContext`, journal path, markets, clock and wallet/chain observers. Each market
|
|
34
|
+
binds the complete instrument ID, side, an exact rational sats/atomic-unit price,
|
|
35
|
+
and maximum full-fill quantity. Limits bind aggregate native atoms, aggregate
|
|
36
|
+
reserved BTC input sats, native/BTC fee reserves per trade and maximum quote
|
|
37
|
+
lifetime. All units are canonical integer strings; inexact rounding rejects.
|
|
38
|
+
These are operator wallet limits, not voucher conversion, issuance or backing policy.
|
|
39
|
+
|
|
40
|
+
Omitting `mode`, or setting it to `disabled`, permits reading/reconciling existing
|
|
41
|
+
records and rejects new quotes/commitments. Choosing `native-regtest` does not
|
|
42
|
+
authorize live funds or enable vouchers. Keep signing secrets and seller preimages
|
|
43
|
+
in the operator's wallet/vault; the journal contains only public signed terms,
|
|
44
|
+
commitment intent, reservations and recovery observations. A seller's statement
|
|
45
|
+
must come from its own safely stored preimage before creating the proposal.
|
|
46
|
+
|
|
47
|
+
The wallet inventory adapter must independently read the same operator's finalized
|
|
48
|
+
native free balance and owned confirmed BTC UTXOs, bind FLOP genesis, BTC network
|
|
49
|
+
and owner key, and timestamp the observation. The maker rejects stale/future data,
|
|
50
|
+
duplicate UTXOs, missing confirmations, reused inputs and insufficient balances or
|
|
51
|
+
fee budgets. It subtracts existing reservations conservatively from free balance;
|
|
52
|
+
held funds may therefore be counted twice until reconciliation. An adapter's object
|
|
53
|
+
is a trusted local wallet observation contract, not cryptographic proof supplied
|
|
54
|
+
by a counterparty. Independent FLOP/BTC settlement observations use the existing
|
|
55
|
+
SDK contracts and exact accepted bindings.
|
|
56
|
+
|
|
57
|
+
In registered mode, callback amounts cannot authorize voucher availability or
|
|
58
|
+
native gas. The maker queries actual same-finalized Assets/Holder storage through
|
|
59
|
+
the qualified source. `source.inventory(proposal, paymentKey)` returns each
|
|
60
|
+
instrument's `free`, `held`, `availableHold` and block hash separately from
|
|
61
|
+
`nativeFree`. Free already excludes held units; `availableHold` preserves the
|
|
62
|
+
minimum from free under the fixture's `Protect`/Freezer=() contract. Corrupt,
|
|
63
|
+
unsupported, nonLive/nonLiquid or inconsistent reason/aggregate state denies.
|
|
64
|
+
Standard absent account and absent optional held balance have explicit zero
|
|
65
|
+
semantics. No exception becomes a zero balance or global drain certificate.
|
|
66
|
+
|
|
67
|
+
Configure `limits.vouchers` with exact `{sdkInstrumentId, ledgerInstrumentId,
|
|
68
|
+
units}` entries. Registered reservations add an optional `voucher` entry to the
|
|
69
|
+
existing v1 journal; `nativeAtoms` remains gas only. Local unsubmitted voucher
|
|
70
|
+
reservations reduce available free. Already included original holds are verified
|
|
71
|
+
again at the inventory block and are not subtracted twice. Operator limits and
|
|
72
|
+
the original trade/UTXO reservation remain in force until reconciliation.
|
|
73
|
+
|
|
74
|
+
## JSON-lines operator API
|
|
75
|
+
|
|
76
|
+
Each line is `{ "id": "request-id", "method": "...", "params": ... }`.
|
|
77
|
+
Responses carry the same ID and `result`, or a generic `error` without private RPC
|
|
78
|
+
exception text. Operations are serialized in this single process.
|
|
79
|
+
|
|
80
|
+
| Method | Params | Result |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `request-quote` | Exact `Proposal` terms | Maker-signed proposal, after operator price/size/expiry and fresh inventory checks |
|
|
83
|
+
| `quote` | `{ id: quoteId }` | Stored signed proposal |
|
|
84
|
+
| `execution-snapshot` | `{ id: quoteId }` | Detached committed recovery and exact reserved BTC inputs; no writable journal access |
|
|
85
|
+
| `accept` | `{ id, request: { body, taker } }` | Full `Acceptance` after verifying taker ownership and durable reservation |
|
|
86
|
+
| `cancel` | `{ id }` | Signed cancellation of uncommitted intent |
|
|
87
|
+
| `replace` | `{ id, terms }` | Signed replacement and cancellation; same ID and exactly next revision |
|
|
88
|
+
| `pin` | `{ id, binding: { escrowId?, btcOutpoint? } }` | Pin immutable recovery identities; this alone proves no funding/payout |
|
|
89
|
+
| `status` | `{ id }` | Independently observed status, reservation flag and global halt flag |
|
|
90
|
+
| `reconcile` | `{}` | Recheck every record before clearing a halt; unresolved signatures remain blocked |
|
|
91
|
+
|
|
92
|
+
Use SDK `acceptanceBody` and `sign(body, "taker", signer)` to construct an acceptance
|
|
93
|
+
request. Quotes are advisory until commitment. The process reserves inventory and
|
|
94
|
+
the selected BTC inputs **before the first maker acceptance signature**. A retry
|
|
95
|
+
after response loss returns the same committed acceptance; a different trade ID
|
|
96
|
+
cannot replace it. Cancel/replacement never frees a committed or uncertain reservation.
|
|
97
|
+
Status messages, a wallet submission receipt and `pin` cannot release inventory.
|
|
98
|
+
After an asynchronous signer returns, expiry, explicit mode and the existing
|
|
99
|
+
lifecycle admission are checked again before publishing. An expired or disabled
|
|
100
|
+
commitment attempt retains its durable reservation and requires recovery; a
|
|
101
|
+
late signature is never treated as safely uncommitted expiry.
|
|
102
|
+
|
|
103
|
+
The local TypeScript owner can execute `executeRegisteredFlop(id, action,
|
|
104
|
+
paymentSigner, secrets)` and `executeRegisteredBtc(id, action, coreWallet,
|
|
105
|
+
feeSats, secrets)`. These methods consume the maker's own recovery adapter and
|
|
106
|
+
reserved inputs, serialize all journal writes, and persist signed references
|
|
107
|
+
before broadcasting once. Open IDs are recovered from successful finalized
|
|
108
|
+
inclusion and matched to the actual original record. Unknown submission keeps
|
|
109
|
+
the pending action and reservations across restart; it never triggers a retry.
|
|
110
|
+
|
|
111
|
+
`@flop-labs/sdk/direct-swap/core-node` exports `RegtestCoreProcess`,
|
|
112
|
+
`BitcoinCliRpc`, `RegtestCoreObserver`, `RegtestCoreWallet`. The process requires
|
|
113
|
+
the existing qualified Rust source and actual binary SHA256/path; requests and
|
|
114
|
+
existing local spend keys travel over stdin. Core cookie custody stays local.
|
|
115
|
+
The wallet uses only the reserved confirmed UTXOs and explicit fee, validates
|
|
116
|
+
the size32 funding with the Rust producer, then broadcasts through standard RPC.
|
|
117
|
+
The observer independently binds funding, spend, active-chain anchors and witness;
|
|
118
|
+
unknown/mempool/orphaned spends cannot become payout receipts. Use
|
|
119
|
+
`recoverRegisteredBtcSecret(id, coreWallet, secrets)` to verify the confirmed exact
|
|
120
|
+
BTC claim into the existing trade vault before voucher satisfy.
|
|
121
|
+
|
|
122
|
+
Seller owns the 32-byte secret and locks vouchers first with the longer absolute
|
|
123
|
+
deadline. Buyer funds BTC after finalized exact voucher lock; seller redeems BTC
|
|
124
|
+
first after the signed profile's confirmations; buyer then satisfies vouchers.
|
|
125
|
+
Campaign admission applies only to new voucher locks and BTC funding. Original
|
|
126
|
+
exits preserve exact record/hold/role/secret/confirmation/timeout checks under
|
|
127
|
+
STOP, expiry or stale campaign time. First reveal still checks the signed safety
|
|
128
|
+
budget. A finalized voucher satisfy witness is history evidence, not a prerequisite
|
|
129
|
+
for the first BTC spend.
|
|
130
|
+
|
|
131
|
+
Reservation release normally requires both existing SDK-verified terminal chain
|
|
132
|
+
receipts with the same settled/refunded outcome. A fresh registered maker-BUY has
|
|
133
|
+
one additional path: the maker's private new-record factory retains its selected
|
|
134
|
+
reservation, which must exactly match the later accepted reservation. Every funding
|
|
135
|
+
dispatch through that private owner atomically marks it started
|
|
136
|
+
with `begin("fund-btc")` before reaching the producer. Only an exact original voucher
|
|
137
|
+
and registered hold refund with matching never-started provenance, no BTC identity
|
|
138
|
+
or receipt, and no unresolved authorization/action/submission can free that capacity.
|
|
139
|
+
Reopen, acceptance and replacement cannot create this provenance. Funding-started
|
|
140
|
+
does not reset when pending/submission state clears. Existing/C3 journals without
|
|
141
|
+
it remain unknown and held; do not retrofit a saved abort. Maker-SELL cannot prove
|
|
142
|
+
the counterparty's funding history, and native preparation does not own execution.
|
|
143
|
+
These conservative limits remain tracked in #3426. This is local execution-owner
|
|
144
|
+
provenance, not a global claim that keys were unused outside this owner.
|
|
145
|
+
A different one-leg or unproven never-funded trade remains reserved for explicit
|
|
146
|
+
recovery; preparation does not infer nonexistence of an
|
|
147
|
+
unobserved counter-lock. Reorg, stale/invalid chain state or RPC failure halts new
|
|
148
|
+
risk; existing bound recovery remains readable. Freshness uses the clock after both
|
|
149
|
+
queries complete. A missing pinned escrow or BTC outpoint requires recovery and
|
|
150
|
+
cannot clear the halt; an unpinned trade may still await funding without releasing
|
|
151
|
+
its reservation. The underlying SDK's confirmation and finality assumptions apply;
|
|
152
|
+
Bitcoin finality is not deterministic.
|
|
153
|
+
|
|
154
|
+
## Crash and shutdown
|
|
155
|
+
|
|
156
|
+
Use one journal per maker wallet; do not run independent journals over the same
|
|
157
|
+
inventory. The process obtains an exclusive `.lock` file for its lifetime and
|
|
158
|
+
rejects a second owner. Updates write a private temporary file, fsync it, rename
|
|
159
|
+
atomically and fsync the directory. A write error prevents further operations until
|
|
160
|
+
reopening; no signature follows a failed reservation write.
|
|
161
|
+
|
|
162
|
+
Clean stdin EOF closes the process and removes its own lock. After a crash, first
|
|
163
|
+
exclude every former owner and wallet broadcaster, preserve the journal and pending
|
|
164
|
+
transaction references, then remove **only this journal's stale `.lock`** and restart
|
|
165
|
+
with the same maker/context. Never delete the journal or infer that expiry/cancel
|
|
166
|
+
freed a signature-uncertain reservation. Retry only the exact original acceptance
|
|
167
|
+
or reconcile it through the original chain bindings. Automatic stale-lock stealing
|
|
168
|
+
is deliberately absent, matching the SDK's existing file-store convention.
|
|
169
|
+
Restart halts new risk whenever an unreleased commitment exists. Reconcile all
|
|
170
|
+
bound trades through the observers before admitting another commitment. An
|
|
171
|
+
uncertain signature cannot clear that halt through a caller assertion.
|
|
172
|
+
|
|
173
|
+
The preparation journal retains quote history and is not automatically pruned.
|
|
174
|
+
Bound an operator run by stopping new quotes before the journal grows beyond its
|
|
175
|
+
operational budget. Rotate to a fresh journal only after every commitment has
|
|
176
|
+
reconciled to verified terminal receipts and every uncommitted offer has expired.
|
|
177
|
+
Archive the complete old journal with its original SDK reader and recovery backups;
|
|
178
|
+
never prune a pending or signature-uncertain record or run the replacement alongside
|
|
179
|
+
the old owner. Production automation needs a separately qualified retention policy.
|
|
180
|
+
|
|
181
|
+
## Verification and remaining acceptance
|
|
182
|
+
|
|
183
|
+
Build in the established contracts → client → SDK order, then run:
|
|
184
|
+
|
|
185
|
+
```sh
|
|
186
|
+
pnpm --filter @flop-labs/sdk exec vitest run tests/direct-swap
|
|
187
|
+
just verify-sdk
|
|
188
|
+
just prep-push
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The focused suite exercises both maker sides, concurrent trade IDs and distinct
|
|
192
|
+
quotes, separate native/UTXO/BTC limits, durable reservations before signing,
|
|
193
|
+
interrupted and delayed signers, expiry equality, disabled mode, restart,
|
|
194
|
+
cancel/replace after commitment, verified terminal receipts and reorg refusal.
|
|
195
|
+
It also launches the built JSON-lines process with local signed test fixtures.
|
|
196
|
+
The inherited native lifecycle and signing behavior stays covered. Registered
|
|
197
|
+
caller tests cover all three sources, exact manifest/descriptor/minimum/unlock
|
|
198
|
+
binding, real storage queries, lying callback inventory, Protect boundaries,
|
|
199
|
+
STOP/expiry/stale-time exits, pending submission and restart reservations.
|
|
200
|
+
|
|
201
|
+
In registered mode `accept` persists its exact request and voucher/gas/UTXO
|
|
202
|
+
reservation, then consumes `RegisteredAssetV1Recovery.signAcceptance` to persist
|
|
203
|
+
the maker's signature intent before signing and cache the proof before export.
|
|
204
|
+
Committed retries return the exact receipt. An interrupted signer with no cached
|
|
205
|
+
proof remains unresolved across restart and must be reconciled with the original
|
|
206
|
+
verified full receipt through `maker.reconcileRegisteredAcceptance(id, receipt)`;
|
|
207
|
+
it is never automatically re-signed. This owner verifies the original exact request
|
|
208
|
+
and all signatures, keeps reservations, and consumes registered recovery's matching
|
|
209
|
+
intent; it does not unhalt the maker or certify chain settlement. `cancel`/`replace`
|
|
210
|
+
consume the same registered owner for cancellation intent. The native maker's
|
|
211
|
+
existing retry behavior and v1 journal meaning remain unchanged. For the other
|
|
212
|
+
party use a separate registered recovery journal and `signAcceptance(...,
|
|
213
|
+
"taker", signer)`, not the stateless signing helper or a writable maker adapter.
|
|
214
|
+
New local journals explicitly mark the signing generation. Unknown legacy pending
|
|
215
|
+
maker records cannot accept, cancel or replace through a new owner signature, and
|
|
216
|
+
reopening/creating an existing record cannot upgrade that uncertainty. Verified
|
|
217
|
+
complete original receipts and exits remain recoverable. Preserve all old journals;
|
|
218
|
+
use a genuinely fresh isolated journal for a new demo, never a reset of old state.
|
|
219
|
+
|
|
220
|
+
This stack has no `verify-direct-btc` recipe: invoking `just --show
|
|
221
|
+
verify-direct-btc` reports that it is absent. The sibling #3423 native harness
|
|
222
|
+
does not connect this coordinator to a broadcaster or independently querying
|
|
223
|
+
maker wallet/chain adapters. A combined maker-buy, maker-sell and refund rehearsal
|
|
224
|
+
therefore remains separate deployment evidence. The executable methods above
|
|
225
|
+
consume the journal's reserved inputs and exact role plans; qualification must
|
|
226
|
+
use the actual pinned runtime and Core artifact with independent chain witnesses.
|
|
227
|
+
No unattended settlement loop or production timing defaults are supplied.
|
|
228
|
+
|
|
229
|
+
Actual vouchers additionally require current runtime asset/lifecycle capability
|
|
230
|
+
and separate, exact per-instrument inventories. Standard Assets50/Holder0.10
|
|
231
|
+
accounting, issuance/backing, source provenance, identical Miner unlock schedules
|
|
232
|
+
and later claims remain prerequisite contracts. This process supplies no
|
|
233
|
+
conversion mapping or economic defaults. #3422/#3423 dependencies and public
|
|
234
|
+
release gates stay open; native unit success cannot close #3426.
|
|
235
|
+
|
|
236
|
+
Stop new quotes before undoing this change. Preserve the journal, original SDK
|
|
237
|
+
reader/adapters, vault backups and exact chain bindings until all commitments are
|
|
238
|
+
reconciled. A code revert cannot undo a signature, broadcast, disclosed preimage,
|
|
239
|
+
mined payout or lost wallet key. No deployment or public listing is supplied here.
|
package/README.md
CHANGED
|
@@ -30,9 +30,9 @@ For the examples, set `FLOP_HTLC_TEE_REQUIREMENTS` to that canonical hex from yo
|
|
|
30
30
|
|
|
31
31
|
TypeScript SDK for the FLOP Network — HTLC workflows, PoI proofs, and account management.
|
|
32
32
|
|
|
33
|
-
`SUPPORTED_SPEC_VERSIONS` in this source admits exactly `1013000`, `1014000`, `1014001`, `1014002`, `1014003`, `1014004`, `1014005`, `1014007`, `1014008`, `1014009`, `1014010`, `1014011`, `1014012`, `1014013`, `1014014`, `1014015`, `1014016`, `1014017`, `1014018`, `1014019`, `1014020`.
|
|
33
|
+
`SUPPORTED_SPEC_VERSIONS` in this source admits exactly `1013000`, `1014000`, `1014001`, `1014002`, `1014003`, `1014004`, `1014005`, `1014007`, `1014008`, `1014009`, `1014010`, `1014011`, `1014012`, `1014013`, `1014014`, `1014015`, `1014016`, `1014017`, `1014018`, `1014019`, `1014020`, `1014021`, `1014022`, `1014023`, `1014024`, `1014025`, `1014026`, `1014027`, `1014029`.
|
|
34
34
|
`SUPPORTED_SPEC_VERSION_RANGE` retains its exported shape as the envelope
|
|
35
|
-
`1013000..
|
|
35
|
+
`1013000..1014029`; admission requires exact membership (including no `1014006` or `1014028`). The published `0.4.0` executable stops at `1014011` and also excludes `1014006`;
|
|
36
36
|
its bundled README has stale connection and HTLC examples. These source corrections
|
|
37
37
|
are unreleased: installing `@latest` does not deliver them until a new version is
|
|
38
38
|
published. The examples below describe this source candidate. Qualification covers
|
|
@@ -409,7 +409,7 @@ Size a compute-channel session before opening it, entirely off chain, using the
|
|
|
409
409
|
- `computeChannel.calibrateSessionPrior` fits that prior to your model and agent configuration from about 10 probe runs.
|
|
410
410
|
- `computeChannel.reforecastSession` updates the quantiles mid-run.
|
|
411
411
|
|
|
412
|
-
See the [
|
|
412
|
+
See the public [upgrade and budget migration guide](https://docs.flop.network/docs/upgrade).
|
|
413
413
|
|
|
414
414
|
### React Hooks (Optional)
|
|
415
415
|
|
|
@@ -687,3 +687,18 @@ For complete setup instructions, hardware requirements, and production deploymen
|
|
|
687
687
|
- [FLOP documentation](https://ask.flop.finance/docs/what-is-flop)
|
|
688
688
|
- [Operator configuration and RPC reference](https://ask.flop.finance/docs/operator-config-reference)
|
|
689
689
|
- [Agent accounts and spend control](https://ask.flop.finance/docs/agent-accounts-and-spend-control)
|
|
690
|
+
|
|
691
|
+
### Direct bilateral BTC HTLC foundation
|
|
692
|
+
|
|
693
|
+
Use the `directSwap` namespace for signed exact-term proposals, full-fill commitment,
|
|
694
|
+
finalized escrow observation and caller-owned restart recovery. See
|
|
695
|
+
[the direct-swap profile](DIRECT_SWAP.md) and `examples/direct-swap.ts` for canonical
|
|
696
|
+
encoding, signed vectors, campaign lifecycle gates and a local mock native rehearsal.
|
|
697
|
+
Voucher transaction construction is unavailable on the current native-only runtime;
|
|
698
|
+
confirmation/time profiles and instrument conversion rules must be explicitly supplied.
|
|
699
|
+
Voucher earning identities are `Agent`, `MinerBlockReward` and `MinerInferenceFee`;
|
|
700
|
+
fixed/floating mode is a separate, explicitly configured mapping with no production
|
|
701
|
+
default. Both miner sources retain the shared Miner unlock class and separate provenance.
|
|
702
|
+
Public documentation: [SDK references](https://docs.flop.network/docs/sdk-references).
|
|
703
|
+
For help or a reproducible bug report, use the [public network tracker](https://github.com/flop-labs/network/issues/new/choose).
|
|
704
|
+
Do not include credentials, seed phrases or private recovery records.
|