@flop-labs/sdk 0.5.2 → 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 +142 -0
- package/DIRECT_SWAP.md +422 -0
- package/DIRECT_SWAP_MAKER.md +239 -0
- package/README.md +36 -6
- 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/capacity-reservation.d.ts +85 -0
- package/dist/compute-channel/capacity-reservation.d.ts.map +1 -0
- package/dist/compute-channel/capacity-reservation.js +127 -0
- package/dist/compute-channel/capacity-reservation.js.map +1 -0
- package/dist/compute-channel/chain.d.ts +4 -0
- package/dist/compute-channel/chain.d.ts.map +1 -1
- package/dist/compute-channel/chain.js +3 -2
- 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/flop-submitter.d.ts +6 -2
- package/dist/compute-channel/flop-submitter.d.ts.map +1 -1
- package/dist/compute-channel/flop-submitter.js +13 -6
- package/dist/compute-channel/flop-submitter.js.map +1 -1
- package/dist/compute-channel/index.d.ts +3 -0
- package/dist/compute-channel/index.d.ts.map +1 -1
- package/dist/compute-channel/index.js +3 -0
- package/dist/compute-channel/index.js.map +1 -1
- package/dist/compute-channel/miner-host.d.ts +10 -2
- package/dist/compute-channel/miner-host.d.ts.map +1 -1
- package/dist/compute-channel/miner-host.js +51 -6
- 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/qwen4-exp.d.ts +83 -0
- package/dist/compute-channel/qwen4-exp.d.ts.map +1 -0
- package/dist/compute-channel/qwen4-exp.js +311 -0
- package/dist/compute-channel/qwen4-exp.js.map +1 -0
- 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 +43 -25
- package/dist/faucet.d.ts.map +1 -1
- package/dist/faucet.js +97 -137
- package/dist/faucet.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- 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/model-loader/verify.d.ts +5 -2
- package/dist/model-loader/verify.d.ts.map +1 -1
- package/dist/model-loader/verify.js +2 -1
- package/dist/model-loader/verify.js.map +1 -1
- package/dist/quickstart.d.ts +21 -17
- package/dist/quickstart.d.ts.map +1 -1
- package/dist/quickstart.js +68 -79
- 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 +11 -2
- package/dist/runtime-compatibility.js.map +1 -1
- package/dist/watch-transaction.d.ts +1 -0
- package/dist/watch-transaction.d.ts.map +1 -1
- package/dist/watch-transaction.js +1 -1
- package/dist/watch-transaction.js.map +1 -1
- package/package.json +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,120 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.7.0] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `SUPPORTED_SPEC_VERSIONS` admits runtimes `1014021` through `1014027`, and
|
|
15
|
+
`SUPPORTED_SPEC_VERSION_RANGE` ends at `1014029`. Existing call indices and encodings are
|
|
16
|
+
unchanged; the v4 fee-profile offer signatures they enable already shipped as opt-in.
|
|
17
|
+
Published `0.6.0` stops at `1014020`, so it rejects the live `1014027`.
|
|
18
|
+
- Admits runtime spec 1,014,029 (candidate 1.14.29: ModelRegistry v4 stamp; 1,014,028 was
|
|
19
|
+
never activated). `1014028` stays rejected.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- Bound direct cooperative settlement reconciliation by the finalized channel's
|
|
24
|
+
remaining lifetime and finality grace, allowing slow evidence publication to finish.
|
|
25
|
+
- Miner settlement helpers validate acknowledged checkpoint prefixes and build
|
|
26
|
+
cooperative proofs and TOPLOC markers without including a rejected tail.
|
|
27
|
+
|
|
28
|
+
- Quickstart `FlopAgent.inference()` and `quickInference()` reject with the underlying
|
|
29
|
+
purchase error instead of resolving an empty unverified result; `quickInference()` shuts
|
|
30
|
+
the agent down on failure, and reports a shutdown failure alongside the original as an
|
|
31
|
+
`AggregateError` whose `cause` is the original. `stream()`, `stream: true` and
|
|
32
|
+
`enableStreaming` reject with `STREAMING_UNSUPPORTED` before any purchase. The result drops
|
|
33
|
+
the never-populated `output` and the fabricated `cost` in favour of `maxCost`, the escrowed
|
|
34
|
+
reward cap; the settlement receipt carries no charged amount or output. Reported in
|
|
35
|
+
flop-labs/network#246 by smvlx, with independent reproduction by almondous.
|
|
36
|
+
|
|
37
|
+
- Preserve the constructor-selected network in `FaucetClient.fund()` results for
|
|
38
|
+
accepted, refused and unknown requests. Reported by
|
|
39
|
+
[sunriseblack](https://github.com/flop-labs/network/issues/244), with an
|
|
40
|
+
[independent artifact reproduction by almondous](https://github.com/flop-labs/network/issues/244#issuecomment-6827837966).
|
|
41
|
+
|
|
42
|
+
- Retain typed direct-session failure stages and conservative recovery outcomes for safe
|
|
43
|
+
CLI composition, without serializing nested errors or adding recovery retries (#4193).
|
|
44
|
+
- Resolve a pending swap spend from either verified terminal outcome on its pinned chain, preserving the actual winning receipt and original cross-chain recovery.
|
|
45
|
+
|
|
46
|
+
- Release a fresh registered maker-BUY reservation after an exact original voucher
|
|
47
|
+
and hold refund only when creation-owned provenance proves funding never started;
|
|
48
|
+
retain conservative holds for SELL, native and unproven old journals.
|
|
49
|
+
|
|
50
|
+
- Expose role-bound partial acceptance verification so callers reject invalid peer proofs
|
|
51
|
+
before recording or signing local authorization.
|
|
52
|
+
|
|
53
|
+
- Reject escrow bindings shared by multiple maker quotes, including saved journals
|
|
54
|
+
and bindings retained after terminal settlement releases inventory.
|
|
55
|
+
|
|
56
|
+
- Reject MLA fields nested under a checkpoint's `text_config` with a named MLA error.
|
|
57
|
+
- Positive TOPLOC replay no longer signs or verifies a Pass for a version-1 activation with a
|
|
58
|
+
lane at the i16 clamp (the #3994 rule); the verifier rereads each committed activation.
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- Direct sessions accept structured chat turns and expose callbacks to persist
|
|
63
|
+
force-open recovery intent and verified settlement material before payment acknowledgement.
|
|
64
|
+
- Direct sessions accept an optional force-open channel lifetime in seconds, defaulting to 120 seconds.
|
|
65
|
+
- `parseMeteringConfig` meters the native MXFP4 gpt-oss-20b @6cee5e81 and gpt-oss-120b
|
|
66
|
+
@b5c939de checkpoints as BF16-activation `layered-v1` models. Their configs state no dtype, so
|
|
67
|
+
BF16 comes from a reviewed binding on the exact `config.json` bytes; any other quantized
|
|
68
|
+
gpt-oss config is still refused (#4233).
|
|
69
|
+
|
|
70
|
+
- RegisteredAssetV1 authenticated manifest, ABI, lifecycle, inventory, recovery and
|
|
71
|
+
single-owner maker execution, with direct wallet submission and qualified regtest
|
|
72
|
+
Core adapters. Actual runtime and binary qualification remain required.
|
|
73
|
+
|
|
74
|
+
- Strict native and compressed-tensors MXFP4 weight metadata, with group-32 E8M0 scales,
|
|
75
|
+
bound tensor scope, BF16 activations and unchanged metering; unsupported architectures remain rejected.
|
|
76
|
+
- Explicit fee-profile-1 spot offers use chain-bound v4 miner/acceptance signatures and the
|
|
77
|
+
profiled-open call. Legacy offer bytes remain unchanged; discovery requires finalized fee
|
|
78
|
+
credit readiness and refuses legacy offers after activation.
|
|
79
|
+
- Operator TOPLOC watchtower runner with finalized chain and verified DA inputs,
|
|
80
|
+
independent prefill execution, durable inclusion reconciliation, and private
|
|
81
|
+
deployment configuration. Production checking defaults to every turn.
|
|
82
|
+
- `FinalizedCompletionRpc.currentReadiness` re-checks a verified positive replay completion
|
|
83
|
+
against the finalized head's profile, policy, members and active-set quorum.
|
|
84
|
+
- Replay policy version 2: a Root-committed, devnet-ts-only `devnetQuorum` that replaces the
|
|
85
|
+
active-set quorum term; refused on every other chain. Version-1 hashing is unchanged.
|
|
86
|
+
|
|
87
|
+
## [0.6.0] - 2026-11-12
|
|
88
|
+
|
|
89
|
+
### Changed
|
|
90
|
+
|
|
91
|
+
- `SUPPORTED_SPEC_VERSIONS` admits runtimes `1014015` through `1014020`, and
|
|
92
|
+
`SUPPORTED_SPEC_VERSION_RANGE` ends at `1014020`. They add the per-miner capacity reservations,
|
|
93
|
+
the model weights lock, the VRF committee seed and the D-0544 unsigned-open tariff. The wire
|
|
94
|
+
bytes the SDK signs are unchanged.
|
|
95
|
+
|
|
96
|
+
### Fixed
|
|
97
|
+
|
|
98
|
+
- Faucet POSTs are no longer automatically retried after ambiguous outcomes. Grant
|
|
99
|
+
confirmation no longer equates a sufficient balance with an attributable grant;
|
|
100
|
+
QuickStart stops on an unknown result instead of silently continuing.
|
|
101
|
+
|
|
102
|
+
- Point public package documentation metadata to the public SDK reference.
|
|
103
|
+
|
|
104
|
+
- Preserve an unknown cooperative settlement outcome when finalized-event polling
|
|
105
|
+
reaches its deadline, preventing a competing force settlement or timeout refund.
|
|
106
|
+
|
|
107
|
+
### Added
|
|
108
|
+
|
|
109
|
+
- `computeChannel.readMinerCapacity` reads a miner's D-0542 capacity reservations at the
|
|
110
|
+
finalized head and returns its live accepted cap, reserved total, the rate the next open would
|
|
111
|
+
reserve, and whether it fits; `undefined` on a runtime without the storage. `minerCapacity`,
|
|
112
|
+
`reservationRateForSessions` and `reservationRateUpdate` are the pure rules behind it.
|
|
113
|
+
|
|
114
|
+
- `fundFromFaucetDetailed` distinguishes refused from unknown requests. The current
|
|
115
|
+
faucet protocol lacks an authenticated request-to-transaction binding, so even a
|
|
116
|
+
successful response remains unknown. `waitForAvailableBalance` explicitly checks
|
|
117
|
+
balance; the older boolean helpers remain as deprecated compatibility aliases.
|
|
118
|
+
|
|
119
|
+
- `SubmitResult.blockHash` names the finalized block when the submitter waits for finality;
|
|
120
|
+
`settlementArgs` and `mapChainEvents` are exported for callers that hold a signer lane.
|
|
121
|
+
- `verifyMirror` accepts `revision`, pinning a whole-repo Hugging Face check to that
|
|
122
|
+
commit instead of resolving `main`.
|
|
123
|
+
|
|
10
124
|
## [0.5.2] - 2026-11-09
|
|
11
125
|
|
|
12
126
|
### Fixed
|
|
@@ -44,6 +158,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
44
158
|
miner-wide CAS capacity ledger and conservative two-operator timing verification.
|
|
45
159
|
These require authenticated adapters and leave activation off.
|
|
46
160
|
|
|
161
|
+
- Fresh enclave info-proof and channel-authentication helpers, with injected peer transports,
|
|
162
|
+
redirect refusal, bounded responses and explicit miner readiness.
|
|
163
|
+
- Disabled-by-default Node maker preparation with signed full-fill quotes,
|
|
164
|
+
operator prices, durable native/UTXO/fee reservations, restart reconciliation
|
|
165
|
+
and a private JSON-lines process. Only explicit native regtest preparation is
|
|
166
|
+
supported; no broadcaster, voucher runtime capability or live activation is supplied.
|
|
167
|
+
- Direct bilateral BTC HTLC proposal/acceptance signatures, exact instrument and
|
|
168
|
+
campaign bindings, finalized native-rehearsal observation, budgeted role plans
|
|
169
|
+
and caller-owned atomic recovery. Voucher execution fails closed until runtime
|
|
170
|
+
asset support exists; new-risk campaign gates retain a fixed 90 elapsed-day
|
|
171
|
+
on-chain timestamp deadline while preserving outstanding recovery claims.
|
|
172
|
+
Source-tagged `Agent`, `MinerBlockReward` and `MinerInferenceFee` identities bind
|
|
173
|
+
finalized earning provenance separately from explicitly configured fixed/floating
|
|
174
|
+
conversion. Both miner sources share Miner unlock terms; no economic mapping,
|
|
175
|
+
issuance rates, backing or caps are supplied.
|
|
176
|
+
- Explicit regtest-only size32 P2SH quotes and accepted-contract mapping to the
|
|
177
|
+
matching Core adapter, with shared public construction/recovery vectors. Existing
|
|
178
|
+
P2WSH signing bytes and legacy position recovery identities remain unchanged.
|
|
47
179
|
- Fresh enclave info-proof and channel-authentication helpers, with injected peer transports,
|
|
48
180
|
redirect refusal, bounded responses and explicit miner readiness.
|
|
49
181
|
|
|
@@ -62,6 +194,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
62
194
|
|
|
63
195
|
### Fixed
|
|
64
196
|
|
|
197
|
+
- Reconcile uncertain FLOP locks from matching finalized release/refund receipts
|
|
198
|
+
after restart while retaining missing, mismatched or stale evidence as unresolved.
|
|
199
|
+
- Mark only new local signing journals with an explicit generation and refuse unknown
|
|
200
|
+
legacy pending owner signatures, retaining verified original receipts/exits.
|
|
201
|
+
- Journal Explorer acceptance/cancel authorizations before wallet signing, retain
|
|
202
|
+
uncertain outcomes across restart, and reject conflicting recovery receipts or
|
|
203
|
+
cancellation while an acceptance remains unresolved. Signed v1 bytes stay unchanged.
|
|
65
204
|
- Reconcile direct-session cooperative settlement using finalized matching claims;
|
|
66
205
|
preserve payment HTTP failures, faucet refusals, and local delegation outcomes.
|
|
67
206
|
- Route package bug reports to the public network issue forms.
|
|
@@ -82,6 +221,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
82
221
|
- Serve qualified retired FCU profiles through the ratified registry contract,
|
|
83
222
|
reject unqualified/emergency-paused execution, and require authenticated sold
|
|
84
223
|
history bounds that fit the complete quota and serving store before initialization.
|
|
224
|
+
- Sample supplied direct-swap clocks after chain observations finish and reuse the
|
|
225
|
+
completion time for freshness and remaining deadline budgets. Explorer planning
|
|
226
|
+
and recovery pass clock callbacks while fixed snapshot timestamps stay supported.
|
|
85
227
|
- Verify FCU execution before pinning late or inconclusive output. Retain absolute
|
|
86
228
|
timing bounds and verified work across restart, reject contradictory refinements,
|
|
87
229
|
and preserve reservations and receipt checkpoints when verification fails.
|
package/DIRECT_SWAP.md
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
# Direct bilateral BTC HTLC foundation (v1)
|
|
2
|
+
|
|
3
|
+
Use `directSwap` from `@flop-labs/sdk`. This transport-independent module exchanges
|
|
4
|
+
signed public terms, commits a single full fill and keeps caller-owned recovery
|
|
5
|
+
metadata. It has no Technocore, order indexer, matcher or registered-relayer dependency.
|
|
6
|
+
There is no voucher ledger in the current runtime. **All voucher transaction plans
|
|
7
|
+
and construction fail closed.** Native FLOP is available only through the explicit
|
|
8
|
+
`native-rehearsal` namespace; it never establishes a voucher balance or settlement.
|
|
9
|
+
|
|
10
|
+
## Exact terms and signatures
|
|
11
|
+
|
|
12
|
+
`Proposal` binds maker and named taker identities, maker side, nonce/id/revision,
|
|
13
|
+
FLOP genesis and environment, Bitcoin network, immutable instrument, earning source, campaign,
|
|
14
|
+
atomic quantity, sats, settlement rail, SHA256 statement, both parties' payment keys,
|
|
15
|
+
script profile, absolute BTC height CLTV, absolute finalized FLOP deadline, supplied
|
|
16
|
+
confirmation/time profile and quote expiry (Unix seconds). All integers are canonical
|
|
17
|
+
decimal strings; calculations use bigint. `quotePrice` returns sats per displayed
|
|
18
|
+
instrument unit as a numerator/denominator. There are no decimal-number amounts,
|
|
19
|
+
partial fills, implicit native asset or production confirmation/time defaults.
|
|
20
|
+
|
|
21
|
+
Exactly three voucher kinds identify earning sources: `Agent`, `MinerBlockReward`
|
|
22
|
+
and `MinerInferenceFee`. Block-reward vouchers and inference-fee vouchers originate
|
|
23
|
+
from separate finalized earning streams. There is no per-compute-receipt split or
|
|
24
|
+
combined miner work score. `native` belongs only to the separate rehearsal namespace.
|
|
25
|
+
|
|
26
|
+
Each instrument id is SHA256 over its complete namespace/kind/conversion-mode/
|
|
27
|
+
conversion-rule/conversion-version/unlock-class/base-units tuple using the instrument
|
|
28
|
+
domain below. `baseUnits` is atoms per displayed unit. Conversion mode is a separate
|
|
29
|
+
`fixed` or `floating` attribute. The source-to-mode mapping, exact rates, backing and
|
|
30
|
+
caps remain pending owner confirmation; no block-reward=fixed or inference-fee=floating
|
|
31
|
+
mapping is supplied. The caller must explicitly allowlist the complete source/mode/rule
|
|
32
|
+
tuple in `SwapContext.instruments`. Missing tuples and null/unconfigured voucher modes
|
|
33
|
+
reject before wallet signing. Local configuration does not authorize issuance or remove
|
|
34
|
+
the native-only runtime execution gate. The valueless golden fixtures test both modes
|
|
35
|
+
for each source explicitly; these combinations are **not effective economic policy**.
|
|
36
|
+
|
|
37
|
+
Signed `source` provenance binds the earning kind, genesis, environment, policy version,
|
|
38
|
+
canonical finalized earning-block hash, event index and an optional receipt id. It must
|
|
39
|
+
match the instrument/network/campaign policy and survives export, commitment, escrow-id
|
|
40
|
+
pinning and local recovery. It is public metadata to verify against the future source
|
|
41
|
+
ledger, not proof that an earning occurred or a wallet balance implies entitlement.
|
|
42
|
+
Each proposal binds one provenance record; this foundation performs no earning-lot
|
|
43
|
+
aggregation or source-ledger accounting.
|
|
44
|
+
Future transfer/escrow/claim adapters must retain the exact earning class and provenance,
|
|
45
|
+
and reject replay of an earning event into another stream. Until qualified runtime
|
|
46
|
+
capability exists, this SDK constructs no voucher transfer, escrow or claim transaction.
|
|
47
|
+
|
|
48
|
+
Both miner sources bind the same `unlockClass: "Miner"` and identical unlock conditions.
|
|
49
|
+
One mainnet earning event/receipt earns unlock credit once across that shared class,
|
|
50
|
+
never separately per source or conversion mode. Runtime claim accounting must persist
|
|
51
|
+
that shared receipt identity atomically; this SDK implements no unlock-credit ledger.
|
|
52
|
+
Keep the two source histories auditable even if a later mainnet Miner grant is merged.
|
|
53
|
+
The earned mainnet entitlements should roughly match the intended existing cohort
|
|
54
|
+
allocations while preserving supply, cohort funding and single-funded claims. The earlier
|
|
55
|
+
local 1% pilot is not operative, and raw floating shares do not establish mainnet-FLOP
|
|
56
|
+
entitlement totals. No allocation arithmetic, rates, backing or caps are introduced here.
|
|
57
|
+
|
|
58
|
+
v1 supports ed25519 identity keys and ed25519 FLOP AccountId32 payment keys, plus
|
|
59
|
+
compressed secp256k1 BTC keys. Seller's FLOP key is the refund/funder key and their
|
|
60
|
+
BTC key is the BTC recipient. Buyer's FLOP key receives the escrow and their BTC key
|
|
61
|
+
refunds the BTC leg. Each party proves ownership of all three keys by signing distinct
|
|
62
|
+
key-purpose domains. These ownership signatures are not Bitcoin transaction signatures.
|
|
63
|
+
Other wallet key schemes require a future explicitly versioned profile.
|
|
64
|
+
|
|
65
|
+
Canonical encoding is UTF-8 JSON with recursively ASCII-sorted object keys, JSON
|
|
66
|
+
string escaping, no whitespace or trailing newline, and strings/null only as leaves.
|
|
67
|
+
Arrays preserve order. Signed schemas reject unknown/missing fields; unsigned extension
|
|
68
|
+
fields, including preimages, cannot be added to a sharing export. Hex is lowercase,
|
|
69
|
+
`0x` prefixed. Integer strings have no sign, exponent, fractional part or leading zeros.
|
|
70
|
+
|
|
71
|
+
The digest preimage is exactly `FLOP/direct-swap/v1/<domain>\n<canonical JSON>`.
|
|
72
|
+
Instrument ids use domain `instrument` (tuple excluding `id`); proposal references use
|
|
73
|
+
`proposal` (complete terms). Signature domains are
|
|
74
|
+
`<proposal|acceptance|cancel>/<maker|taker>/<identity|flopKey|btcKey>`. Signatures sign
|
|
75
|
+
the 32-byte SHA256 digest: ed25519 for identity/FLOP, compact 64-byte low-S ECDSA for
|
|
76
|
+
BTC (no additional hashing). Acceptance contains version/kind/proposalHash/tradeId;
|
|
77
|
+
both parties sign it. Cancellation binds the old proposal hash/id/revision and both
|
|
78
|
+
network domains, plus an optional replacement proposal hash.
|
|
79
|
+
|
|
80
|
+
[`tests/fixtures/direct-swap-v1.json`](https://github.com/flop-labs/flop-core/blob/main/sdk/typescript/tests/fixtures/direct-swap-v1.json) pins the
|
|
81
|
+
canonical proposal bytes, digest and deterministic signed proposal/acceptance/cancel.
|
|
82
|
+
It also pins identities and signatures for all three sources under both explicit modes.
|
|
83
|
+
Regenerate with `pnpm --filter @flop-labs/sdk exec node --import tsx tests/fixtures/generate-direct-swap.ts`.
|
|
84
|
+
Append `--check` to verify the committed bytes and signatures without rewriting them.
|
|
85
|
+
Tests mutate every signed term, profile value, acceptance and cancellation field.
|
|
86
|
+
The repository secret scanner exempts only the twelve exact public payment-key and
|
|
87
|
+
ownership-signature field/value lines generated by this vector. Scanner regressions
|
|
88
|
+
verify that changed values, other field names, appended credentials and neighboring
|
|
89
|
+
credential fields remain detected; no file or path is excluded.
|
|
90
|
+
|
|
91
|
+
## Commitment and lifecycle
|
|
92
|
+
|
|
93
|
+
Use `createProposal` to validate before wallet signing, then `exportProposal` /
|
|
94
|
+
`importProposal` for transport. Export/import checks signed structure and ownership;
|
|
95
|
+
it does not establish current campaign availability or settlement. `sign` is the
|
|
96
|
+
lower-level domain-signing primitive. An ordinary signed quote remains advisory.
|
|
97
|
+
The taker supplies their acceptance signatures; the maker reserves before signing a
|
|
98
|
+
binding acceptance naming exactly that proposal, taker and trade id. **The caller
|
|
99
|
+
must reserve assets and serialize the maker's commitments across its local workers.**
|
|
100
|
+
There is no distributed CAS service. `SwapRecovery.accept` atomically commits one
|
|
101
|
+
acceptance before expiry; an exact duplicate is idempotent, another trade is rejected.
|
|
102
|
+
A signed cancel/replace affects only uncommitted intent. Replacement advances one
|
|
103
|
+
revision. Cancel cannot revoke commitment, refund a lock, or revoke a fixed payee's claim.
|
|
104
|
+
|
|
105
|
+
Voucher proposals bind campaign id/devnet-or-testnet environment/genesis/policy version
|
|
106
|
+
and its stored activation and risk deadline in timestamp milliseconds. `CampaignObserver`
|
|
107
|
+
must independently read campaign storage, supported asset ids, `Timestamp.Now` and its
|
|
108
|
+
current-block validation marker at the same canonical finalized block. The marker must
|
|
109
|
+
equal that block's height: absent, stale and pre-inherent time rejects new risk. Missing
|
|
110
|
+
capability is default-off. `authorizeNewRisk` requires the same explicit `SwapContext`
|
|
111
|
+
source/mode mapping and gates proposal/commit/mint/ordinary
|
|
112
|
+
transfer/new-lock authorization: require active, explicitly activated, fresh finalized
|
|
113
|
+
chain time and `riskDeadlineMs = activationTimestampMs + 7,776,000,000` (90 elapsed
|
|
114
|
+
days). It also checks elapsed wall time since observation conservatively; it never
|
|
115
|
+
computes the campaign lifetime from an assumed one-second block interval.
|
|
116
|
+
|
|
117
|
+
Manual stop is terminal; elapsed expiry also closes new risk. Campaigns are one-shot,
|
|
118
|
+
with no same-campaign reset, resume or renewal. Restarts and supported runtime upgrades
|
|
119
|
+
retain the original activation/deadline and manual-stop facts. Recovery persists valid
|
|
120
|
+
closure observations even when subsequent acceptance rejects; it refuses a reset or
|
|
121
|
+
contradictory observation. Committed metadata, duplicate acceptance receipts,
|
|
122
|
+
canceling uncommitted intent, outstanding redeem/refund and chain recovery do not run
|
|
123
|
+
an active-campaign gate. Fixed beneficiary/funder checks still apply, and balances and
|
|
124
|
+
reserved claims cannot be erased by lifecycle changes. `campaignStatus` distinguishes
|
|
125
|
+
never-enabled, active, stopped-draining, expired-draining and drained.
|
|
126
|
+
`assertTerminalSnapshotDrained` requires permanent closure and finalized zero reserves,
|
|
127
|
+
open escrows and pending settlements; it is a necessary guard, not a
|
|
128
|
+
snapshot transaction or runtime enforcement implementation. No issuance, activation,
|
|
129
|
+
rates/caps or emergency-pause implementation is introduced here. #3430 owns current-block
|
|
130
|
+
Timestamp and internal-mutation admission, preserves BABE's `OnTimestampSet` behavior,
|
|
131
|
+
and coordinates with #3347's emergency pause. #1688/#3175 may land behind enforced
|
|
132
|
+
deny-admission providers before #3430; their presence must not enable trading. Until that
|
|
133
|
+
runtime capability and asset binding are qualified, every voucher transaction remains
|
|
134
|
+
unavailable, including attempts to interpret native escrow as a voucher claim.
|
|
135
|
+
Existing voucher recovery metadata remains readable without lifecycle admission;
|
|
136
|
+
asset transaction construction stays unavailable until the real asset escrow is qualified.
|
|
137
|
+
|
|
138
|
+
## Observation, plans and recovery
|
|
139
|
+
|
|
140
|
+
The voucher seller owns the 32-byte preimage and locks the longer FLOP leg first.
|
|
141
|
+
The buyer independently verifies finalized exact FLOP storage before funding BTC.
|
|
142
|
+
The seller independently verifies a confirmed exact BTC output before revealing.
|
|
143
|
+
The profile supplies confirmation depth, block-time budget inputs, finality allowance,
|
|
144
|
+
funding/reveal/redeem/safety budgets and maximum observation age. New-risk budget checks deduct
|
|
145
|
+
observation age and reject excessive finality lag, insufficient remaining time or a
|
|
146
|
+
FLOP leg that no longer outlasts BTC. Once BTC redemption is confirmed, FLOP witness
|
|
147
|
+
submission remains available despite exhausted time budgets or excessive finality lag;
|
|
148
|
+
fresh exact chain observations and the matching secret are still required. A verified
|
|
149
|
+
BTC redemption or refund also resolves an outstanding funding journal after restart.
|
|
150
|
+
These inputs require operator qualification;
|
|
151
|
+
fixture values are not production guarantees about block arrival or finality.
|
|
152
|
+
|
|
153
|
+
`NativeRehearsalChain` uses existing Substrate transaction signers and escrow encoding.
|
|
154
|
+
`open` accepts raw native units, explicit namespace and a relative timeout; it waits
|
|
155
|
+
for finalized successful dispatch and one matching `EscrowOpened` before returning
|
|
156
|
+
`{ txHash, blockHash, escrowId }`. It supports a caller's durable `noteSubmission`
|
|
157
|
+
callback. Existing `FlopClient.openEscrow`, `satisfyEscrow` and `refundEscrow` retain
|
|
158
|
+
their original public APIs. The runtime computes its refund deadline from inclusion,
|
|
159
|
+
so opening cannot guarantee an absolute signed deadline. Before BTC funding or reveal,
|
|
160
|
+
require the actual finalized funder/payee/amount/hash/policy/deadline to match exactly.
|
|
161
|
+
A delayed or mismatched native rehearsal lock needs refund/recovery; accepted terms
|
|
162
|
+
are never silently rewritten to fit it.
|
|
163
|
+
|
|
164
|
+
`observe` reads escrow storage and finalized-prefix storage at one finalized block.
|
|
165
|
+
Stored beneficiary determines payout even if another witness submitter calls
|
|
166
|
+
`satisfyEscrow`. Refund requires the funder. BTC adapters must verify the **exact
|
|
167
|
+
signed script profile and its canonical script/output**, outpoint, sats, network,
|
|
168
|
+
SHA256 statement, recipient, refund key, absolute CLTV and confirmations, and verify
|
|
169
|
+
the spend and payout beneficiary before returning a terminal receipt. Both supported
|
|
170
|
+
profiles require this claim/refund script; the P2WSH or P2SH output envelope is also
|
|
171
|
+
part of the profile:
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
OP_IF
|
|
175
|
+
OP_SIZE 32 OP_EQUALVERIFY OP_SHA256 <statement> OP_EQUALVERIFY
|
|
176
|
+
<seller compressed key> OP_CHECKSIG
|
|
177
|
+
OP_ELSE
|
|
178
|
+
<minimal absolute height CLTV> OP_CHECKLOCKTIMEVERIFY OP_DROP
|
|
179
|
+
<buyer compressed key> OP_CHECKSIG
|
|
180
|
+
OP_ENDIF
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Minimal script encodings, witness branch selection and Bitcoin transaction signing,
|
|
184
|
+
validation, broadcasting and backend qualification belong to sibling Bitcoin work.
|
|
185
|
+
`BtcObserver` is a trusted qualified chain adapter boundary, never a peer message or
|
|
186
|
+
an unverified HTTP claim. The SDK provides no second Bitcoin implementation.
|
|
187
|
+
|
|
188
|
+
The original `p2wsh-sha256-cltv-v1` profile and its canonical signed vectors remain
|
|
189
|
+
unchanged. New devnet/local-rehearsal quotes may explicitly select
|
|
190
|
+
`regtest-p2sh-sha256-size32-height-cltv-v1`, restricted to Bitcoin regtest.
|
|
191
|
+
`regtestSize32Contract(proposal, acceptance, context)` verifies the signed proposal,
|
|
192
|
+
both acceptances and local context, then returns the exact offline Core adapter
|
|
193
|
+
descriptor. Pass it as `{ operation: "size32-contract", request: descriptor }` to the
|
|
194
|
+
additive adapter from [#3480](https://github.com/flop-labs/flop-core/issues/3480).
|
|
195
|
+
The handoff requires at least the reused Core rehearsal's three BTC confirmations.
|
|
196
|
+
New-risk plans also retain its strict remaining reserves of more than twelve finalized
|
|
197
|
+
FLOP blocks and four BTC blocks, alongside the existing duration/finality/observation-age
|
|
198
|
+
budget checks. These are regtest backend constraints, not production finality policy.
|
|
199
|
+
This mapping neither funds an output nor establishes a runtime or chain capability.
|
|
200
|
+
|
|
201
|
+
The descriptor requires the explicit profile, regtest network, SHA256 hash, compressed
|
|
202
|
+
seller/payee and buyer/refund keys, and absolute Bitcoin `lock_height`. It does not
|
|
203
|
+
reinterpret the signed Bitcoin height as Unix seconds or convert the separate finalized
|
|
204
|
+
FLOP `flopDeadline`; `expiresAt` remains quote-expiry seconds. Timeout profiles remain
|
|
205
|
+
explicit signed assumptions. Test-only controlled-mining values and three confirmations
|
|
206
|
+
are local qualification inputs, not a production timing policy or deterministic
|
|
207
|
+
conversion between chain clocks.
|
|
208
|
+
|
|
209
|
+
The separate [legacy regtest rehearsal #3434](https://github.com/flop-labs/flop-core/pull/3434)
|
|
210
|
+
uses `regtest-p2sh-sha256-height-cltv-v1`, whose on-chain script lacks the size guard.
|
|
211
|
+
It remains unsupported by this SDK. An existing signed P2WSH or legacy P2SH position
|
|
212
|
+
cannot be relabeled or translated into the new profile, including during recovery.
|
|
213
|
+
The example still uses local mocks. Actual chain observation, consensus qualification
|
|
214
|
+
of the new Core profile and [release qualification #3428](https://github.com/flop-labs/flop-core/issues/3428)
|
|
215
|
+
remain separate requirements. Voucher execution stays unavailable until the actual
|
|
216
|
+
asset runtime and its immutable instrument/minimum-balance capability are qualified;
|
|
217
|
+
a descriptor or native success does not authorize a voucher counter-lock.
|
|
218
|
+
|
|
219
|
+
`DirectSwapPlanner.inspect` distinguishes pending, unconfirmed, locked, redeemable,
|
|
220
|
+
settled, refund-eligible, refunded and recovery-required. Both confirmed chain payouts
|
|
221
|
+
are required for overall `settled`. A missing or conflicting finalized record,
|
|
222
|
+
unresolved submission, lost terminal BTC receipt or chain error requires recovery.
|
|
223
|
+
Messages and wallet submission receipts alone do not complete a payout.
|
|
224
|
+
|
|
225
|
+
For asynchronous chain adapters, pass a clock callback to `inspect`, `plan` and
|
|
226
|
+
`SwapRecovery.observe`, for example `planner.inspect(() => connection.now())`.
|
|
227
|
+
The callback is sampled once after both observations finish; freshness and remaining
|
|
228
|
+
deadline budgets use that same time. Fixed timestamp strings remain supported for
|
|
229
|
+
explicit snapshot/test callers.
|
|
230
|
+
|
|
231
|
+
Implement `RecoveryStorage.update` as a durable atomic transaction serialized per key
|
|
232
|
+
across every local worker, rolling back if the change callback throws. Reconcile any
|
|
233
|
+
uncertain persistence error before broadcasting. Persist proposals, acceptance,
|
|
234
|
+
immutable expected escrow id/outpoint, submission references, observed block hashes and
|
|
235
|
+
terminal receipts. Plans journal `pendingAction` before returning to a broadcaster;
|
|
236
|
+
persistence failure must prevent broadcast. After handoff, use `noteSubmission` and
|
|
237
|
+
`pin`, then independently observe. Never automatically repeat an ambiguous lock or
|
|
238
|
+
funding transaction. Recreate `SwapRecovery` against the same store after restart.
|
|
239
|
+
`recoverOpen` recovers a native escrow id from an intended-chain wallet transaction
|
|
240
|
+
and canonical finalized block, selecting only that extrinsic's events. Without a
|
|
241
|
+
transaction/block witness, reconcile through the caller's wallet and chain history;
|
|
242
|
+
leave recovery-required until positively resolved. No discovery service stores keys.
|
|
243
|
+
|
|
244
|
+
`SecretStorage` is a separate explicitly local encrypted wallet/vault. Save and back
|
|
245
|
+
up the seller's secret **before** locking; restore it explicitly after restart. Buyers
|
|
246
|
+
may import the publicly revealed preimage from a verified BTC spend to their own local
|
|
247
|
+
vault before FLOP redemption. Do not include vault data or recovery metadata in proposal
|
|
248
|
+
exports or sharing logs. Plans contain no preimage. Recheck fresh plans immediately
|
|
249
|
+
before external signing/broadcast; do not execute old exported plans after delay.
|
|
250
|
+
|
|
251
|
+
Run `pnpm --filter @flop-labs/sdk exec node --import tsx examples/direct-swap.ts` and add `--refund`
|
|
252
|
+
for the refund branch. This is a local **mock native rehearsal**, with a caller-owned
|
|
253
|
+
atomic disk store, explicit local secret file and restart; it sends no transactions.
|
|
254
|
+
The example uses disposable test signing keys, and prints only public terms/plans.
|
|
255
|
+
Superseded pre-publication miner-fixed/miner-floating proposals are rejected rather
|
|
256
|
+
than guessed into a source or re-signed. Preserve their original local metadata and
|
|
257
|
+
original reader for recovery; no production voucher positions have been enabled here.
|
|
258
|
+
|
|
259
|
+
## Validation and rollback
|
|
260
|
+
|
|
261
|
+
Run `just verify-sdk`; focused tests are `pnpm --filter @flop-labs/sdk exec vitest run
|
|
262
|
+
tests/direct-swap-protocol.test.ts tests/direct-swap-adapter.test.ts tests/direct-swap-lifecycle.test.ts tests/direct-swap-regtest.test.ts`.
|
|
263
|
+
No deployment, live funds, pair listing or publication witness is part of this task.
|
|
264
|
+
|
|
265
|
+
Recovery owner: the application/operator controlling the caller-owned store and wallets.
|
|
266
|
+
Retain the matching profile's SDK reader and Core adapter until every bound exit is
|
|
267
|
+
reconciled; a prior P2WSH-only SDK cannot read the new regtest recovery state.
|
|
268
|
+
Disable new proposal/acceptance/lock creation, retain recovery metadata and local vault
|
|
269
|
+
backups, then revert the SDK change. Re-observe every known escrow/outpoint with the
|
|
270
|
+
previous chain tools and reconcile fixed-beneficiary payouts/refunds. Verify no
|
|
271
|
+
outstanding reserves remain before deleting state or taking a terminal snapshot.
|
|
272
|
+
A code revert cannot reverse a broadcast transaction, revealed preimage, payout or lost
|
|
273
|
+
secret. This implementation performs none of those external actions by itself.
|
|
274
|
+
|
|
275
|
+
## Land card
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
LAND CARD
|
|
279
|
+
parent SHA : 0f1cc87aaedcac7668e641021863fbb1cf09c627
|
|
280
|
+
still on origin/main? : yes (checked against the available origin/main ref)
|
|
281
|
+
what this does : Binds Agent, MinerBlockReward and MinerInferenceFee source provenance separately from explicit conversion modes, with shared Miner unlock terms and native-only rehearsal execution.
|
|
282
|
+
files : 22: 8 direct-swap source modules; root export; 7 test/vector/generator files; example; profile, README, CHANGELOG, package manifest and exact public-vector scanner configuration.
|
|
283
|
+
envelope : Additive TypeScript SDK namespace; no runtime/storage migration, issuance, service or deployment change.
|
|
284
|
+
protocol/crypto/sim? : v1 off-chain signed encoding and payment-key ownership verification; no new cryptographic primitive or economic simulation.
|
|
285
|
+
public input ingested? : yes, supplied owner structural/lifecycle clarifications and fetched #3422/#3430 issue bodies treated as requirements/data; no embedded tool instructions executed.
|
|
286
|
+
checkpoint : none (Entire search reported unauthenticated).
|
|
287
|
+
sim : skipped; no economic rates/caps or runtime changes, candidate fixtures only.
|
|
288
|
+
decision needed : Accept the SDK-only foundation with voucher execution unavailable, or defer publication until runtime asset/lifecycle qualification?
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## RegisteredAssetV1 ABI preparation (partial, unavailable for trading)
|
|
292
|
+
|
|
293
|
+
The additive `directSwap.RegisteredAssetV1Abi` surface reads the separate
|
|
294
|
+
`EscrowsV1` map at one finalized block, validates its historical metadata, and
|
|
295
|
+
strictly decodes the pinned AccountId32/u32 V1 Registered/And([Hash]) record.
|
|
296
|
+
`openUnsigned` constructs call 30 with raw units and the exact **absolute**
|
|
297
|
+
deadline. `satisfyUnsigned` and `refundUnsigned` construct calls 31/32 against
|
|
298
|
+
exact original terms and fresh finalized observations. None signs, broadcasts,
|
|
299
|
+
changes recovery storage or qualifies a runtime provider. An unsigned call can
|
|
300
|
+
still fail runtime dispatch; preserve existing recovery/journaling before any
|
|
301
|
+
future authorized broadcast. Native constructors and exact matching retain their
|
|
302
|
+
relative-deadline refusal.
|
|
303
|
+
|
|
304
|
+
Use `voucherLedgerDescriptorId` for the full immutable runtime descriptor and
|
|
305
|
+
`instrumentId` for the existing signed JSON instrument. They are distinct domains.
|
|
306
|
+
Descriptor fields include network/environment/campaign/policy commitments,
|
|
307
|
+
revision, source, conversion mode/rule/version, atomic unit, positive minimum
|
|
308
|
+
balance and exact unlock terms/version. Missing metadata or minimum balance
|
|
309
|
+
rejects construction; wallet balances do not supply any of these commitments.
|
|
310
|
+
The three earning sources and independently selected conversion modes remain
|
|
311
|
+
separate; the runtime ledger requires equal Miner unlock terms.
|
|
312
|
+
`registeredAssetV1LedgerBinding` and `registeredAssetV1HoldId` expose the existing
|
|
313
|
+
runtime namespace/authority/terms and ledger obligation identity. Their hashes
|
|
314
|
+
alone establish neither a canonical hold nor payout authority.
|
|
315
|
+
|
|
316
|
+
The unqualified two-argument `prepareRegisteredAssetV1RolePlan` still refuses
|
|
317
|
+
before journaling. The additive executable path is `RegisteredAssetV1Source` →
|
|
318
|
+
`RegisteredAssetV1Recovery` → `RegisteredAssetV1Planner`. It requires a local
|
|
319
|
+
manifest, trusted SwapContext and actual runtime qualification pins. Method
|
|
320
|
+
presence, counterparty messages and UI/environment flags do not enable it.
|
|
321
|
+
|
|
322
|
+
`buildVoucherDevnetManifest(core)` authenticates the explicit display/version to
|
|
323
|
+
full Descriptor association. Policy is Blake2b256 of UTF8
|
|
324
|
+
`FLOP/voucher-devnet/manifest-core/v1\n` followed by the existing canonical JSON
|
|
325
|
+
of CORE, with no prefix or NUL. CORE contains only schema, deployment, sdk and
|
|
326
|
+
three ordered instrument/descriptor templates (Agent, MinerBlockReward,
|
|
327
|
+
MinerInferenceFee), without derived IDs, policy or activation timestamps. The
|
|
328
|
+
builder returns `policy`, `descriptorScope`, `campaignDeployment`, `descriptors`,
|
|
329
|
+
`instruments`, `sdk`; descriptor scope environment is H256, whereas campaign
|
|
330
|
+
deployment environment is the actual `Devnet` enum. Existing signed instrument
|
|
331
|
+
SHA256 and ledger Blake2/SCALE domains stay distinct and unchanged. The shared
|
|
332
|
+
golden is `tests/fixtures/registered-asset-manifest-v1.json`.
|
|
333
|
+
|
|
334
|
+
Construct `new RegisteredAssetV1Source(api, core, runtimePin, context,
|
|
335
|
+
millisecondsClock)` with explicit source/genesis/code/metadata/version/marker pins
|
|
336
|
+
from the qualified isolated fixture artifact. Every read uses one finalized state
|
|
337
|
+
for immutable bootstrap completion/configuration, all three full descriptors,
|
|
338
|
+
standard Assets minima/status, actual campaign activation and successful included
|
|
339
|
+
timestamp inherent matching Timestamp.Now. No ephemeral ObservedTime is required.
|
|
340
|
+
The source verifies signed earning coordinates against the canonical ledger Credit
|
|
341
|
+
before initial admission; balances do not create earning authority. A source pin
|
|
342
|
+
alone or synthetic metadata does not establish that the composition is deployed.
|
|
343
|
+
|
|
344
|
+
Use `createRegisteredAssetV1Proposal` for qualified proposal signing. The free
|
|
345
|
+
`sign` and `createRegisteredAssetV1AcceptanceRequest` helpers are stateless; they
|
|
346
|
+
do not provide a durable authorization journal. For a partial acceptance, first
|
|
347
|
+
create a `RegisteredAssetV1Recovery` with the existing caller-owned atomic durable
|
|
348
|
+
store, then call `recovery.signAcceptance(tradeId, "taker", signer)` and exchange
|
|
349
|
+
`{ body: acceptanceBody(proposal.terms, tradeId), taker: proof }`. The maker owner
|
|
350
|
+
uses the same method with `"maker"`; `DirectSwapMaker.accept` consumes it internally
|
|
351
|
+
in registered mode. Intent is durable before any of the three keys signs, and the
|
|
352
|
+
exact proof is cached before export. A repeated matching request returns that proof;
|
|
353
|
+
an unresolved signer/persistence outcome or conflicting ID/role/cancel refuses
|
|
354
|
+
across restart. Reconcile the exact verified full receipt through `recovery.accept`.
|
|
355
|
+
Use `recovery.signCancel(signer, replacement?)`, then `recovery.cancel` for a
|
|
356
|
+
verified cancellation/replacement; only successful matching completion clears intent.
|
|
357
|
+
Each party owns its own journal; never attach another writer to a maker journal.
|
|
358
|
+
Only newly created local journals carry `signingGeneration: "intent-v1"`.
|
|
359
|
+
An old pending record without that marker may have exported a stateless partial
|
|
360
|
+
signature. Owners refuse new acceptance/cancel/replacement signing for it;
|
|
361
|
+
`create(existing)` never stamps it clean. Preserve the old journal and reconcile
|
|
362
|
+
authenticated complete original receipts/exits. Do not delete, rewrite or infer
|
|
363
|
+
cleanliness from a missing signature intent. The marker is local metadata, not a
|
|
364
|
+
signed-field or wire-schema change.
|
|
365
|
+
Recovery keeps
|
|
366
|
+
the existing atomic v1 store and adds separate registered evidence, without fake
|
|
367
|
+
legacy obligation counters. Planner queries both chains before sampling the
|
|
368
|
+
completion clock and constructs existing call30 with the absolute signed deadline,
|
|
369
|
+
then calls31/32 against original exact records and canonical holds. Only new
|
|
370
|
+
voucher locks and BTC funding require active/fresh campaign admission. Seller BTC
|
|
371
|
+
redemption/revelation retains the signed first-reveal safety budget, exact lock,
|
|
372
|
+
confirmation and secret guards. It and original satisfy/refunds remain available
|
|
373
|
+
after STOP/expiry/stale campaign time. STOP time stays unknown; global drain stays
|
|
374
|
+
unavailable. Fresh original-chain/record evidence remains required for exits.
|
|
375
|
+
|
|
376
|
+
Registered lock/funding and first BTC reveal budget sites independently query the
|
|
377
|
+
qualified source API's current best height and require `best >= H >= naturalPrefix`
|
|
378
|
+
and `best - naturalPrefix <= profile.flopFinalityBlocks`. The whole profile must
|
|
379
|
+
match the signed/context allowlist; there is no default or private-profile override.
|
|
380
|
+
Both wallet transports repeat the relevant checks after signing, before recording
|
|
381
|
+
the signed submission hash or sending. Completion clocks are sampled after these
|
|
382
|
+
awaits. First reveal after STOP still needs this timing bound, without active
|
|
383
|
+
campaign admission. A private vault secret or privately persisted signed claim is
|
|
384
|
+
not public evidence. Only the independently verified original confirmed BTC
|
|
385
|
+
claim/witness bypasses the new aggregate check; old freshness, exact original,
|
|
386
|
+
budget and uncertain-submission guards remain. The wallet still refuses duplicate
|
|
387
|
+
execution of a pending signed transaction; no automatic rebroadcast API is added.
|
|
388
|
+
Confirmed-secret voucher satisfy and both original refunds receive no aggregate gate.
|
|
389
|
+
|
|
390
|
+
An uncertain lock first reobserved offline as an exact finalized release/refund
|
|
391
|
+
also reconciles pending action and submission atomically. Registered escrow
|
|
392
|
+
`Released` must correspond to the exact original ledger `Paid` hold; `Refunded`
|
|
393
|
+
must correspond to `Refunded`. Original receipts/bindings are retained, while
|
|
394
|
+
missing, stale, unknown or mismatched record evidence stays unresolved.
|
|
395
|
+
|
|
396
|
+
`directSwapWallet` consumes the existing separate ed25519 identity/payment keys
|
|
397
|
+
and compressed secp256k1 proof signer. `submitDirectSwapTransaction` accepts a
|
|
398
|
+
registered planner's exact in-process plan, records the signed transaction hash
|
|
399
|
+
durably before send and preserves pending uncertainty on failure. A submission
|
|
400
|
+
receipt does not prove payout. `RegisteredAssetV1History` independently recovers
|
|
401
|
+
the included open ID and verifies a finalized satisfy-call witness, including
|
|
402
|
+
supported utility nesting. The V1 release event contains no preimage.
|
|
403
|
+
|
|
404
|
+
`examples/registered-asset-v1.ts` demonstrates readback and unsigned refund
|
|
405
|
+
reconstruction from separately retained **original raw ledger terms**, without
|
|
406
|
+
requiring an active campaign. This is ABI preparation, not a bridge from a signed
|
|
407
|
+
proposal to a ledger entitlement. Exact exits remain independent of STOP/cutoff;
|
|
408
|
+
wrong/corrupt/terminal records, mismatching parties/assets and stale observations
|
|
409
|
+
refuse. These helpers do not certify a canonical ledger payout, global drain,
|
|
410
|
+
earning authority, backend hold or actual voucher/BTC trade.
|
|
411
|
+
|
|
412
|
+
The immutable Rust source/fixture hashes and synthetic-metadata limits are in
|
|
413
|
+
`tests/fixtures/registered-asset-v1/README.md`. The source pin is
|
|
414
|
+
`1b5df610a106e75448dbb413bed128b1b0dba47f`; no pallet source is bundled here.
|
|
415
|
+
Actual runtime/binary qualification, exact-head publication CI and isolated
|
|
416
|
+
maker buy/sell/no-reveal refund execution remain separate acceptance evidence.
|
|
417
|
+
The Node-only Core adapter consumes the existing Rust size32 producer and
|
|
418
|
+
standard Core RPCs; it introduces no Bitcoin implementation or PSBT producer.
|
|
419
|
+
|
|
420
|
+
Rollback: stop new risk and revert the additive SDK code while retaining the
|
|
421
|
+
original reader, private journals, vault and exact chain bindings. A revert cannot
|
|
422
|
+
undo signatures, broadcasts, revealed secrets or finalized trades.
|