crypto-aio 0.0.3 → 0.1.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 +17 -0
- package/README.md +144 -14
- package/dist/adapters/avalanche/address.d.ts +15 -0
- package/dist/adapters/avalanche/address.js +74 -0
- package/dist/adapters/avalanche/address.js.map +1 -0
- package/dist/adapters/avalanche/api.d.ts +100 -0
- package/dist/adapters/avalanche/api.js +381 -0
- package/dist/adapters/avalanche/api.js.map +1 -0
- package/dist/adapters/avalanche/builder.d.ts +13 -0
- package/dist/adapters/avalanche/builder.js +336 -0
- package/dist/adapters/avalanche/builder.js.map +1 -0
- package/dist/adapters/avalanche/cb58.d.ts +7 -0
- package/dist/adapters/avalanche/cb58.js +49 -0
- package/dist/adapters/avalanche/cb58.js.map +1 -0
- package/dist/adapters/avalanche/chains.d.ts +21 -0
- package/dist/adapters/avalanche/chains.js +79 -0
- package/dist/adapters/avalanche/chains.js.map +1 -0
- package/dist/adapters/avalanche/codec.d.ts +94 -0
- package/dist/adapters/avalanche/codec.js +371 -0
- package/dist/adapters/avalanche/codec.js.map +1 -0
- package/dist/adapters/avalanche/context.d.ts +59 -0
- package/dist/adapters/avalanche/context.js +114 -0
- package/dist/adapters/avalanche/context.js.map +1 -0
- package/dist/adapters/avalanche/decode.d.ts +16 -0
- package/dist/adapters/avalanche/decode.js +101 -0
- package/dist/adapters/avalanche/decode.js.map +1 -0
- package/dist/adapters/avalanche/driver.d.ts +22 -0
- package/dist/adapters/avalanche/driver.js +81 -0
- package/dist/adapters/avalanche/driver.js.map +1 -0
- package/dist/adapters/avalanche/errors.d.ts +18 -0
- package/dist/adapters/avalanche/errors.js +61 -0
- package/dist/adapters/avalanche/errors.js.map +1 -0
- package/dist/adapters/avalanche/fees.d.ts +23 -0
- package/dist/adapters/avalanche/fees.js +105 -0
- package/dist/adapters/avalanche/fees.js.map +1 -0
- package/dist/adapters/avalanche/index.d.ts +19 -0
- package/dist/adapters/avalanche/index.js +8 -0
- package/dist/adapters/avalanche/index.js.map +1 -0
- package/dist/adapters/avalanche/network.d.ts +37 -0
- package/dist/adapters/avalanche/network.js +135 -0
- package/dist/adapters/avalanche/network.js.map +1 -0
- package/dist/adapters/avalanche/plugin.d.ts +21 -0
- package/dist/adapters/avalanche/plugin.js +46 -0
- package/dist/adapters/avalanche/plugin.js.map +1 -0
- package/dist/adapters/avalanche/presets.d.ts +6 -0
- package/dist/adapters/avalanche/presets.js +86 -0
- package/dist/adapters/avalanche/presets.js.map +1 -0
- package/dist/adapters/avalanche/proofs.d.ts +41 -0
- package/dist/adapters/avalanche/proofs.js +270 -0
- package/dist/adapters/avalanche/proofs.js.map +1 -0
- package/dist/adapters/avalanche/reader.d.ts +40 -0
- package/dist/adapters/avalanche/reader.js +231 -0
- package/dist/adapters/avalanche/reader.js.map +1 -0
- package/dist/adapters/avalanche/sdk.d.ts +182 -0
- package/dist/adapters/avalanche/sdk.js +21 -0
- package/dist/adapters/avalanche/sdk.js.map +1 -0
- package/dist/adapters/avalanche/types.d.ts +86 -0
- package/dist/{type/common.js → adapters/avalanche/types.js} +1 -1
- package/dist/adapters/avalanche/types.js.map +1 -0
- package/dist/adapters/evm/builder.d.ts +11 -0
- package/dist/adapters/evm/builder.js +326 -0
- package/dist/adapters/evm/builder.js.map +1 -0
- package/dist/adapters/evm/chains.d.ts +6 -0
- package/dist/adapters/evm/chains.js +203 -0
- package/dist/adapters/evm/chains.js.map +1 -0
- package/dist/adapters/evm/client.d.ts +84 -0
- package/dist/adapters/evm/client.js +335 -0
- package/dist/adapters/evm/client.js.map +1 -0
- package/dist/adapters/evm/decode.d.ts +35 -0
- package/dist/adapters/evm/decode.js +170 -0
- package/dist/adapters/evm/decode.js.map +1 -0
- package/dist/adapters/evm/driver.d.ts +8 -0
- package/dist/adapters/evm/driver.js +61 -0
- package/dist/adapters/evm/driver.js.map +1 -0
- package/dist/adapters/evm/errors.d.ts +20 -0
- package/dist/adapters/evm/errors.js +110 -0
- package/dist/adapters/evm/errors.js.map +1 -0
- package/dist/adapters/evm/ethers-client.d.ts +43 -0
- package/dist/adapters/evm/ethers-client.js +135 -0
- package/dist/adapters/evm/ethers-client.js.map +1 -0
- package/dist/adapters/evm/fees.d.ts +79 -0
- package/dist/adapters/evm/fees.js +234 -0
- package/dist/adapters/evm/fees.js.map +1 -0
- package/dist/adapters/evm/index.d.ts +20 -0
- package/dist/adapters/evm/index.js +11 -0
- package/dist/adapters/evm/index.js.map +1 -0
- package/dist/adapters/evm/network.d.ts +60 -0
- package/dist/adapters/evm/network.js +131 -0
- package/dist/adapters/evm/network.js.map +1 -0
- package/dist/adapters/evm/plugin.d.ts +36 -0
- package/dist/adapters/evm/plugin.js +102 -0
- package/dist/adapters/evm/plugin.js.map +1 -0
- package/dist/adapters/evm/presets.d.ts +2 -0
- package/dist/adapters/evm/presets.js +105 -0
- package/dist/adapters/evm/presets.js.map +1 -0
- package/dist/adapters/evm/proofs.d.ts +19 -0
- package/dist/adapters/evm/proofs.js +358 -0
- package/dist/adapters/evm/proofs.js.map +1 -0
- package/dist/adapters/evm/rawtx.d.ts +25 -0
- package/dist/adapters/evm/rawtx.js +176 -0
- package/dist/adapters/evm/rawtx.js.map +1 -0
- package/dist/adapters/evm/reader.d.ts +65 -0
- package/dist/adapters/evm/reader.js +292 -0
- package/dist/adapters/evm/reader.js.map +1 -0
- package/dist/adapters/evm/rpc.d.ts +39 -0
- package/dist/adapters/evm/rpc.js +152 -0
- package/dist/adapters/evm/rpc.js.map +1 -0
- package/dist/adapters/evm/tokens.d.ts +7 -0
- package/dist/adapters/evm/tokens.js +23 -0
- package/dist/adapters/evm/tokens.js.map +1 -0
- package/dist/adapters/evm/types.d.ts +255 -0
- package/dist/{type/account.js → adapters/evm/types.js} +1 -1
- package/dist/adapters/evm/types.js.map +1 -0
- package/dist/adapters/evm/web3-client.d.ts +23 -0
- package/dist/adapters/evm/web3-client.js +159 -0
- package/dist/adapters/evm/web3-client.js.map +1 -0
- package/dist/adapters/solana/builder.d.ts +18 -0
- package/dist/adapters/solana/builder.js +545 -0
- package/dist/adapters/solana/builder.js.map +1 -0
- package/dist/adapters/solana/chains.d.ts +13 -0
- package/dist/adapters/solana/chains.js +37 -0
- package/dist/adapters/solana/chains.js.map +1 -0
- package/dist/adapters/solana/decode.d.ts +111 -0
- package/dist/adapters/solana/decode.js +595 -0
- package/dist/adapters/solana/decode.js.map +1 -0
- package/dist/adapters/solana/driver.d.ts +15 -0
- package/dist/adapters/solana/driver.js +72 -0
- package/dist/adapters/solana/driver.js.map +1 -0
- package/dist/adapters/solana/errors.d.ts +36 -0
- package/dist/adapters/solana/errors.js +154 -0
- package/dist/adapters/solana/errors.js.map +1 -0
- package/dist/adapters/solana/fees.d.ts +68 -0
- package/dist/adapters/solana/fees.js +205 -0
- package/dist/adapters/solana/fees.js.map +1 -0
- package/dist/adapters/solana/heights.d.ts +47 -0
- package/dist/adapters/solana/heights.js +185 -0
- package/dist/adapters/solana/heights.js.map +1 -0
- package/dist/adapters/solana/history.d.ts +10 -0
- package/dist/adapters/solana/history.js +71 -0
- package/dist/adapters/solana/history.js.map +1 -0
- package/dist/adapters/solana/index.d.ts +16 -0
- package/dist/adapters/solana/index.js +9 -0
- package/dist/adapters/solana/index.js.map +1 -0
- package/dist/adapters/solana/keys.d.ts +13 -0
- package/dist/adapters/solana/keys.js +69 -0
- package/dist/adapters/solana/keys.js.map +1 -0
- package/dist/adapters/solana/network.d.ts +24 -0
- package/dist/adapters/solana/network.js +95 -0
- package/dist/adapters/solana/network.js.map +1 -0
- package/dist/adapters/solana/plugin.d.ts +18 -0
- package/dist/adapters/solana/plugin.js +41 -0
- package/dist/adapters/solana/plugin.js.map +1 -0
- package/dist/adapters/solana/presets.d.ts +2 -0
- package/dist/adapters/solana/presets.js +77 -0
- package/dist/adapters/solana/presets.js.map +1 -0
- package/dist/adapters/solana/programs.d.ts +44 -0
- package/dist/adapters/solana/programs.js +159 -0
- package/dist/adapters/solana/programs.js.map +1 -0
- package/dist/adapters/solana/proofs.d.ts +56 -0
- package/dist/adapters/solana/proofs.js +540 -0
- package/dist/adapters/solana/proofs.js.map +1 -0
- package/dist/adapters/solana/reader.d.ts +82 -0
- package/dist/adapters/solana/reader.js +326 -0
- package/dist/adapters/solana/reader.js.map +1 -0
- package/dist/adapters/solana/rpc.d.ts +102 -0
- package/dist/adapters/solana/rpc.js +301 -0
- package/dist/adapters/solana/rpc.js.map +1 -0
- package/dist/adapters/solana/tokens.d.ts +7 -0
- package/dist/adapters/solana/tokens.js +19 -0
- package/dist/adapters/solana/tokens.js.map +1 -0
- package/dist/adapters/solana/types.d.ts +121 -0
- package/dist/{type/contract.js → adapters/solana/types.js} +1 -1
- package/dist/adapters/solana/types.js.map +1 -0
- package/dist/adapters/solana/web3.d.ts +5 -0
- package/dist/adapters/solana/web3.js +83 -0
- package/dist/adapters/solana/web3.js.map +1 -0
- package/dist/adapters/solana/wire.d.ts +62 -0
- package/dist/adapters/solana/wire.js +168 -0
- package/dist/adapters/solana/wire.js.map +1 -0
- package/dist/adapters/ton/address.d.ts +43 -0
- package/dist/adapters/ton/address.js +168 -0
- package/dist/adapters/ton/address.js.map +1 -0
- package/dist/adapters/ton/api.d.ts +344 -0
- package/dist/adapters/ton/api.js +942 -0
- package/dist/adapters/ton/api.js.map +1 -0
- package/dist/adapters/ton/builder.d.ts +18 -0
- package/dist/adapters/ton/builder.js +701 -0
- package/dist/adapters/ton/builder.js.map +1 -0
- package/dist/adapters/ton/chains.d.ts +16 -0
- package/dist/adapters/ton/chains.js +39 -0
- package/dist/adapters/ton/chains.js.map +1 -0
- package/dist/adapters/ton/decode.d.ts +43 -0
- package/dist/adapters/ton/decode.js +219 -0
- package/dist/adapters/ton/decode.js.map +1 -0
- package/dist/adapters/ton/driver.d.ts +10 -0
- package/dist/adapters/ton/driver.js +117 -0
- package/dist/adapters/ton/driver.js.map +1 -0
- package/dist/adapters/ton/errors.d.ts +36 -0
- package/dist/adapters/ton/errors.js +89 -0
- package/dist/adapters/ton/errors.js.map +1 -0
- package/dist/adapters/ton/fees.d.ts +28 -0
- package/dist/adapters/ton/fees.js +121 -0
- package/dist/adapters/ton/fees.js.map +1 -0
- package/dist/adapters/ton/index.d.ts +16 -0
- package/dist/adapters/ton/index.js +9 -0
- package/dist/adapters/ton/index.js.map +1 -0
- package/dist/adapters/ton/messages.d.ts +157 -0
- package/dist/adapters/ton/messages.js +397 -0
- package/dist/adapters/ton/messages.js.map +1 -0
- package/dist/adapters/ton/native-client.d.ts +10 -0
- package/dist/adapters/ton/native-client.js +47 -0
- package/dist/adapters/ton/native-client.js.map +1 -0
- package/dist/adapters/ton/network.d.ts +58 -0
- package/dist/adapters/ton/network.js +207 -0
- package/dist/adapters/ton/network.js.map +1 -0
- package/dist/adapters/ton/plugin.d.ts +24 -0
- package/dist/adapters/ton/plugin.js +57 -0
- package/dist/adapters/ton/plugin.js.map +1 -0
- package/dist/adapters/ton/presets.d.ts +6 -0
- package/dist/adapters/ton/presets.js +94 -0
- package/dist/adapters/ton/presets.js.map +1 -0
- package/dist/adapters/ton/proofs.d.ts +66 -0
- package/dist/adapters/ton/proofs.js +813 -0
- package/dist/adapters/ton/proofs.js.map +1 -0
- package/dist/adapters/ton/reader.d.ts +194 -0
- package/dist/adapters/ton/reader.js +781 -0
- package/dist/adapters/ton/reader.js.map +1 -0
- package/dist/adapters/ton/tokens.d.ts +10 -0
- package/dist/adapters/ton/tokens.js +27 -0
- package/dist/adapters/ton/tokens.js.map +1 -0
- package/dist/adapters/ton/trace.d.ts +48 -0
- package/dist/adapters/ton/trace.js +277 -0
- package/dist/adapters/ton/trace.js.map +1 -0
- package/dist/adapters/ton/types.d.ts +105 -0
- package/dist/{type/transact.js → adapters/ton/types.js} +1 -1
- package/dist/adapters/ton/types.js.map +1 -0
- package/dist/adapters/ton/wallets.d.ts +86 -0
- package/dist/adapters/ton/wallets.js +373 -0
- package/dist/adapters/ton/wallets.js.map +1 -0
- package/dist/adapters/tron/abi.d.ts +39 -0
- package/dist/adapters/tron/abi.js +110 -0
- package/dist/adapters/tron/abi.js.map +1 -0
- package/dist/adapters/tron/address.d.ts +20 -0
- package/dist/adapters/tron/address.js +110 -0
- package/dist/adapters/tron/address.js.map +1 -0
- package/dist/adapters/tron/builder.d.ts +12 -0
- package/dist/adapters/tron/builder.js +553 -0
- package/dist/adapters/tron/builder.js.map +1 -0
- package/dist/adapters/tron/chains.d.ts +12 -0
- package/dist/adapters/tron/chains.js +35 -0
- package/dist/adapters/tron/chains.js.map +1 -0
- package/dist/adapters/tron/codec.d.ts +10 -0
- package/dist/adapters/tron/codec.js +322 -0
- package/dist/adapters/tron/codec.js.map +1 -0
- package/dist/adapters/tron/decode.d.ts +50 -0
- package/dist/adapters/tron/decode.js +280 -0
- package/dist/adapters/tron/decode.js.map +1 -0
- package/dist/adapters/tron/driver.d.ts +12 -0
- package/dist/adapters/tron/driver.js +106 -0
- package/dist/adapters/tron/driver.js.map +1 -0
- package/dist/adapters/tron/errors.d.ts +74 -0
- package/dist/adapters/tron/errors.js +261 -0
- package/dist/adapters/tron/errors.js.map +1 -0
- package/dist/adapters/tron/fees.d.ts +49 -0
- package/dist/adapters/tron/fees.js +166 -0
- package/dist/adapters/tron/fees.js.map +1 -0
- package/dist/adapters/tron/http.d.ts +173 -0
- package/dist/adapters/tron/http.js +729 -0
- package/dist/adapters/tron/http.js.map +1 -0
- package/dist/adapters/tron/index.d.ts +16 -0
- package/dist/adapters/tron/index.js +15 -0
- package/dist/adapters/tron/index.js.map +1 -0
- package/dist/adapters/tron/network.d.ts +44 -0
- package/dist/adapters/tron/network.js +163 -0
- package/dist/adapters/tron/network.js.map +1 -0
- package/dist/adapters/tron/plugin.d.ts +17 -0
- package/dist/adapters/tron/plugin.js +39 -0
- package/dist/adapters/tron/plugin.js.map +1 -0
- package/dist/adapters/tron/presets.d.ts +5 -0
- package/dist/adapters/tron/presets.js +68 -0
- package/dist/adapters/tron/presets.js.map +1 -0
- package/dist/adapters/tron/proofs.d.ts +80 -0
- package/dist/adapters/tron/proofs.js +370 -0
- package/dist/adapters/tron/proofs.js.map +1 -0
- package/dist/adapters/tron/protobuf.d.ts +36 -0
- package/dist/adapters/tron/protobuf.js +90 -0
- package/dist/adapters/tron/protobuf.js.map +1 -0
- package/dist/adapters/tron/reader.d.ts +47 -0
- package/dist/adapters/tron/reader.js +203 -0
- package/dist/adapters/tron/reader.js.map +1 -0
- package/dist/adapters/tron/tokens.d.ts +7 -0
- package/dist/adapters/tron/tokens.js +14 -0
- package/dist/adapters/tron/tokens.js.map +1 -0
- package/dist/adapters/tron/types.d.ts +166 -0
- package/dist/adapters/tron/types.js +3 -0
- package/dist/adapters/tron/types.js.map +1 -0
- package/dist/adapters/utxo/address.d.ts +51 -0
- package/dist/adapters/utxo/address.js +341 -0
- package/dist/adapters/utxo/address.js.map +1 -0
- package/dist/adapters/utxo/builder.d.ts +35 -0
- package/dist/adapters/utxo/builder.js +380 -0
- package/dist/adapters/utxo/builder.js.map +1 -0
- package/dist/adapters/utxo/chains.d.ts +17 -0
- package/dist/adapters/utxo/chains.js +99 -0
- package/dist/adapters/utxo/chains.js.map +1 -0
- package/dist/adapters/utxo/codec.d.ts +120 -0
- package/dist/adapters/utxo/codec.js +408 -0
- package/dist/adapters/utxo/codec.js.map +1 -0
- package/dist/adapters/utxo/coinselect.d.ts +48 -0
- package/dist/adapters/utxo/coinselect.js +131 -0
- package/dist/adapters/utxo/coinselect.js.map +1 -0
- package/dist/adapters/utxo/context.d.ts +57 -0
- package/dist/adapters/utxo/context.js +118 -0
- package/dist/adapters/utxo/context.js.map +1 -0
- package/dist/adapters/utxo/decode.d.ts +14 -0
- package/dist/adapters/utxo/decode.js +85 -0
- package/dist/adapters/utxo/decode.js.map +1 -0
- package/dist/adapters/utxo/driver.d.ts +16 -0
- package/dist/adapters/utxo/driver.js +74 -0
- package/dist/adapters/utxo/driver.js.map +1 -0
- package/dist/adapters/utxo/ecc.d.ts +9 -0
- package/dist/adapters/utxo/ecc.js +26 -0
- package/dist/adapters/utxo/ecc.js.map +1 -0
- package/dist/adapters/utxo/errors.d.ts +52 -0
- package/dist/adapters/utxo/errors.js +191 -0
- package/dist/adapters/utxo/errors.js.map +1 -0
- package/dist/adapters/utxo/esplora.d.ts +79 -0
- package/dist/adapters/utxo/esplora.js +451 -0
- package/dist/adapters/utxo/esplora.js.map +1 -0
- package/dist/adapters/utxo/fees.d.ts +41 -0
- package/dist/adapters/utxo/fees.js +125 -0
- package/dist/adapters/utxo/fees.js.map +1 -0
- package/dist/adapters/utxo/index.d.ts +17 -0
- package/dist/adapters/utxo/index.js +8 -0
- package/dist/adapters/utxo/index.js.map +1 -0
- package/dist/adapters/utxo/network.d.ts +50 -0
- package/dist/adapters/utxo/network.js +165 -0
- package/dist/adapters/utxo/network.js.map +1 -0
- package/dist/adapters/utxo/plugin.d.ts +17 -0
- package/dist/adapters/utxo/plugin.js +41 -0
- package/dist/adapters/utxo/plugin.js.map +1 -0
- package/dist/adapters/utxo/presets.d.ts +12 -0
- package/dist/adapters/utxo/presets.js +47 -0
- package/dist/adapters/utxo/presets.js.map +1 -0
- package/dist/adapters/utxo/preview.d.ts +3 -0
- package/dist/adapters/utxo/preview.js +65 -0
- package/dist/adapters/utxo/preview.js.map +1 -0
- package/dist/adapters/utxo/proofs.d.ts +57 -0
- package/dist/adapters/utxo/proofs.js +331 -0
- package/dist/adapters/utxo/proofs.js.map +1 -0
- package/dist/adapters/utxo/rawtx.d.ts +59 -0
- package/dist/adapters/utxo/rawtx.js +234 -0
- package/dist/adapters/utxo/rawtx.js.map +1 -0
- package/dist/adapters/utxo/reader.d.ts +36 -0
- package/dist/adapters/utxo/reader.js +265 -0
- package/dist/adapters/utxo/reader.js.map +1 -0
- package/dist/adapters/utxo/sdk.d.ts +18 -0
- package/dist/adapters/utxo/sdk.js +17 -0
- package/dist/adapters/utxo/sdk.js.map +1 -0
- package/dist/adapters/utxo/signed-psbt.d.ts +36 -0
- package/dist/adapters/utxo/signed-psbt.js +428 -0
- package/dist/adapters/utxo/signed-psbt.js.map +1 -0
- package/dist/adapters/utxo/spend.d.ts +59 -0
- package/dist/adapters/utxo/spend.js +230 -0
- package/dist/adapters/utxo/spend.js.map +1 -0
- package/dist/adapters/utxo/types.d.ts +167 -0
- package/dist/adapters/utxo/types.js +3 -0
- package/dist/adapters/utxo/types.js.map +1 -0
- package/dist/core/assets/service.d.ts +18 -0
- package/dist/core/assets/service.js +69 -0
- package/dist/core/assets/service.js.map +1 -0
- package/dist/core/blockchain/default-ref.d.ts +4 -0
- package/dist/core/blockchain/default-ref.js +16 -0
- package/dist/core/blockchain/default-ref.js.map +1 -0
- package/dist/core/blockchain/handle.d.ts +200 -0
- package/dist/core/blockchain/handle.js +579 -0
- package/dist/core/blockchain/handle.js.map +1 -0
- package/dist/core/blockchain/internal.d.ts +19 -0
- package/dist/core/blockchain/internal.js +16 -0
- package/dist/core/blockchain/internal.js.map +1 -0
- package/dist/core/blockchain/mapping.d.ts +22 -0
- package/dist/core/blockchain/mapping.js +136 -0
- package/dist/core/blockchain/mapping.js.map +1 -0
- package/dist/core/config/env.d.ts +8 -0
- package/dist/core/config/env.js +60 -0
- package/dist/core/config/env.js.map +1 -0
- package/dist/core/config/merge.d.ts +26 -0
- package/dist/core/config/merge.js +144 -0
- package/dist/core/config/merge.js.map +1 -0
- package/dist/core/config/resolve.d.ts +12 -0
- package/dist/core/config/resolve.js +251 -0
- package/dist/core/config/resolve.js.map +1 -0
- package/dist/core/config/types.d.ts +165 -0
- package/dist/core/config/types.js +3 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/container/builtins.d.ts +4 -0
- package/dist/core/container/builtins.js +13 -0
- package/dist/core/container/builtins.js.map +1 -0
- package/dist/core/container/container.d.ts +69 -0
- package/dist/core/container/container.js +466 -0
- package/dist/core/container/container.js.map +1 -0
- package/dist/core/container/default.d.ts +15 -0
- package/dist/core/container/default.js +70 -0
- package/dist/core/container/default.js.map +1 -0
- package/dist/core/container/internals.d.ts +54 -0
- package/dist/core/container/internals.js +21 -0
- package/dist/core/container/internals.js.map +1 -0
- package/dist/core/container/pool.d.ts +27 -0
- package/dist/core/container/pool.js +77 -0
- package/dist/core/container/pool.js.map +1 -0
- package/dist/core/driver/types.d.ts +346 -0
- package/dist/core/driver/types.js +3 -0
- package/dist/core/driver/types.js.map +1 -0
- package/dist/core/errors/codes.d.ts +153 -0
- package/dist/core/errors/codes.js +49 -0
- package/dist/core/errors/codes.js.map +1 -0
- package/dist/core/errors/error.d.ts +66 -0
- package/dist/core/errors/error.js +129 -0
- package/dist/core/errors/error.js.map +1 -0
- package/dist/core/events/bus.d.ts +12 -0
- package/dist/core/events/bus.js +46 -0
- package/dist/core/events/bus.js.map +1 -0
- package/dist/core/events/logger.d.ts +13 -0
- package/dist/core/events/logger.js +42 -0
- package/dist/core/events/logger.js.map +1 -0
- package/dist/core/events/types.d.ts +131 -0
- package/dist/core/events/types.js +3 -0
- package/dist/core/events/types.js.map +1 -0
- package/dist/core/lifecycle/engine-rules.d.ts +107 -0
- package/dist/core/lifecycle/engine-rules.js +257 -0
- package/dist/core/lifecycle/engine-rules.js.map +1 -0
- package/dist/core/lifecycle/engine.d.ts +500 -0
- package/dist/core/lifecycle/engine.js +1732 -0
- package/dist/core/lifecycle/engine.js.map +1 -0
- package/dist/core/lifecycle/evaluate.d.ts +19 -0
- package/dist/core/lifecycle/evaluate.js +72 -0
- package/dist/core/lifecycle/evaluate.js.map +1 -0
- package/dist/core/lifecycle/intent.d.ts +11 -0
- package/dist/core/lifecycle/intent.js +88 -0
- package/dist/core/lifecycle/intent.js.map +1 -0
- package/dist/core/lifecycle/monitor.d.ts +138 -0
- package/dist/core/lifecycle/monitor.js +606 -0
- package/dist/core/lifecycle/monitor.js.map +1 -0
- package/dist/core/lifecycle/observations.d.ts +17 -0
- package/dist/core/lifecycle/observations.js +59 -0
- package/dist/core/lifecycle/observations.js.map +1 -0
- package/dist/core/lifecycle/reconcile.d.ts +58 -0
- package/dist/core/lifecycle/reconcile.js +112 -0
- package/dist/core/lifecycle/reconcile.js.map +1 -0
- package/dist/core/lifecycle/views.d.ts +49 -0
- package/dist/core/lifecycle/views.js +57 -0
- package/dist/core/lifecycle/views.js.map +1 -0
- package/dist/core/lifecycle/workers.d.ts +82 -0
- package/dist/core/lifecycle/workers.js +329 -0
- package/dist/core/lifecycle/workers.js.map +1 -0
- package/dist/core/model/address.d.ts +32 -0
- package/dist/core/model/address.js +43 -0
- package/dist/core/model/address.js.map +1 -0
- package/dist/core/model/amount.d.ts +25 -0
- package/dist/core/model/amount.js +102 -0
- package/dist/core/model/amount.js.map +1 -0
- package/dist/core/model/asset.d.ts +28 -0
- package/dist/core/model/asset.js +47 -0
- package/dist/core/model/asset.js.map +1 -0
- package/dist/core/model/capability.d.ts +3 -0
- package/dist/core/model/capability.js +18 -0
- package/dist/core/model/capability.js.map +1 -0
- package/dist/core/model/chain.d.ts +63 -0
- package/dist/core/model/chain.js +8 -0
- package/dist/core/model/chain.js.map +1 -0
- package/dist/core/model/fee.d.ts +36 -0
- package/dist/core/model/fee.js +17 -0
- package/dist/core/model/fee.js.map +1 -0
- package/dist/core/model/ids.d.ts +37 -0
- package/dist/core/model/ids.js +13 -0
- package/dist/core/model/ids.js.map +1 -0
- package/dist/core/model/intent.d.ts +63 -0
- package/dist/core/model/intent.js +81 -0
- package/dist/core/model/intent.js.map +1 -0
- package/dist/core/model/ordering.d.ts +20 -0
- package/dist/core/model/ordering.js +29 -0
- package/dist/core/model/ordering.js.map +1 -0
- package/dist/core/model/transaction.d.ts +116 -0
- package/dist/{type/lib-types.js → core/model/transaction.js} +1 -1
- package/dist/core/model/transaction.js.map +1 -0
- package/dist/core/observe/scanner.d.ts +135 -0
- package/dist/core/observe/scanner.js +355 -0
- package/dist/core/observe/scanner.js.map +1 -0
- package/dist/core/ordering/reservations.d.ts +16 -0
- package/dist/core/ordering/reservations.js +53 -0
- package/dist/core/ordering/reservations.js.map +1 -0
- package/dist/core/ordering/sequence.d.ts +61 -0
- package/dist/core/ordering/sequence.js +155 -0
- package/dist/core/ordering/sequence.js.map +1 -0
- package/dist/core/registry/adapters.d.ts +10 -0
- package/dist/core/registry/adapters.js +56 -0
- package/dist/core/registry/adapters.js.map +1 -0
- package/dist/core/registry/assets.d.ts +18 -0
- package/dist/core/registry/assets.js +90 -0
- package/dist/core/registry/assets.js.map +1 -0
- package/dist/core/registry/chains.d.ts +10 -0
- package/dist/core/registry/chains.js +80 -0
- package/dist/core/registry/chains.js.map +1 -0
- package/dist/core/registry/plugin.d.ts +41 -0
- package/dist/core/registry/plugin.js +109 -0
- package/dist/core/registry/plugin.js.map +1 -0
- package/dist/core/registry/providers.d.ts +31 -0
- package/dist/core/registry/providers.js +43 -0
- package/dist/core/registry/providers.js.map +1 -0
- package/dist/core/registry/schemes.d.ts +30 -0
- package/dist/core/registry/schemes.js +84 -0
- package/dist/core/registry/schemes.js.map +1 -0
- package/dist/core/secret/fragments.d.ts +33 -0
- package/dist/core/secret/fragments.js +110 -0
- package/dist/core/secret/fragments.js.map +1 -0
- package/dist/core/secret/redact.d.ts +10 -0
- package/dist/core/secret/redact.js +110 -0
- package/dist/core/secret/redact.js.map +1 -0
- package/dist/core/secret/secret.d.ts +14 -0
- package/dist/core/secret/secret.js +42 -0
- package/dist/core/secret/secret.js.map +1 -0
- package/dist/core/signing/callback.d.ts +10 -0
- package/dist/core/signing/callback.js +22 -0
- package/dist/core/signing/callback.js.map +1 -0
- package/dist/core/signing/guard.d.ts +18 -0
- package/dist/core/signing/guard.js +72 -0
- package/dist/core/signing/guard.js.map +1 -0
- package/dist/core/signing/hd.d.ts +36 -0
- package/dist/core/signing/hd.js +167 -0
- package/dist/core/signing/hd.js.map +1 -0
- package/dist/core/signing/local.d.ts +48 -0
- package/dist/core/signing/local.js +190 -0
- package/dist/core/signing/local.js.map +1 -0
- package/dist/core/signing/orchestrator.d.ts +40 -0
- package/dist/core/signing/orchestrator.js +300 -0
- package/dist/core/signing/orchestrator.js.map +1 -0
- package/dist/core/signing/types.d.ts +64 -0
- package/dist/core/signing/types.js +3 -0
- package/dist/core/signing/types.js.map +1 -0
- package/dist/core/signing/wallet.d.ts +48 -0
- package/dist/core/signing/wallet.js +153 -0
- package/dist/core/signing/wallet.js.map +1 -0
- package/dist/core/store/clone.d.ts +25 -0
- package/dist/core/store/clone.js +71 -0
- package/dist/core/store/clone.js.map +1 -0
- package/dist/core/store/memory.d.ts +38 -0
- package/dist/core/store/memory.js +325 -0
- package/dist/core/store/memory.js.map +1 -0
- package/dist/core/store/types.d.ts +246 -0
- package/dist/core/store/types.js +117 -0
- package/dist/core/store/types.js.map +1 -0
- package/dist/core/transport/backoff.d.ts +8 -0
- package/dist/core/transport/backoff.js +27 -0
- package/dist/core/transport/backoff.js.map +1 -0
- package/dist/core/transport/circuit.d.ts +25 -0
- package/dist/core/transport/circuit.js +61 -0
- package/dist/core/transport/circuit.js.map +1 -0
- package/dist/core/transport/http-transport.d.ts +30 -0
- package/dist/core/transport/http-transport.js +1695 -0
- package/dist/core/transport/http-transport.js.map +1 -0
- package/dist/core/transport/rate-limit.d.ts +27 -0
- package/dist/core/transport/rate-limit.js +78 -0
- package/dist/core/transport/rate-limit.js.map +1 -0
- package/dist/core/transport/stale-view.d.ts +11 -0
- package/dist/core/transport/stale-view.js +17 -0
- package/dist/core/transport/stale-view.js.map +1 -0
- package/dist/core/transport/types.d.ts +144 -0
- package/dist/core/transport/types.js +6 -0
- package/dist/core/transport/types.js.map +1 -0
- package/dist/core/util/bytes.d.ts +9 -0
- package/dist/core/util/bytes.js +40 -0
- package/dist/core/util/bytes.js.map +1 -0
- package/dist/core/util/clock.d.ts +6 -0
- package/dist/core/util/clock.js +26 -0
- package/dist/core/util/clock.js.map +1 -0
- package/dist/core/util/freeze.d.ts +8 -0
- package/dist/core/util/freeze.js +31 -0
- package/dist/core/util/freeze.js.map +1 -0
- package/dist/core/util/json.d.ts +29 -0
- package/dist/core/util/json.js +165 -0
- package/dist/core/util/json.js.map +1 -0
- package/dist/core/util/names.d.ts +21 -0
- package/dist/core/util/names.js +46 -0
- package/dist/core/util/names.js.map +1 -0
- package/dist/index.d.ts +64 -14
- package/dist/index.js +105 -49
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +21 -0
- package/dist/native.js +44 -0
- package/dist/native.js.map +1 -0
- package/dist/testing/contracts/api.d.ts +12 -0
- package/dist/testing/contracts/api.js +58 -0
- package/dist/testing/contracts/api.js.map +1 -0
- package/dist/testing/contracts/cursors.d.ts +6 -0
- package/dist/testing/contracts/cursors.js +43 -0
- package/dist/testing/contracts/cursors.js.map +1 -0
- package/dist/testing/contracts/locks.d.ts +10 -0
- package/dist/testing/contracts/locks.js +63 -0
- package/dist/testing/contracts/locks.js.map +1 -0
- package/dist/testing/contracts/operations.d.ts +21 -0
- package/dist/testing/contracts/operations.js +718 -0
- package/dist/testing/contracts/operations.js.map +1 -0
- package/dist/testing/contracts/sequences.d.ts +6 -0
- package/dist/testing/contracts/sequences.js +68 -0
- package/dist/testing/contracts/sequences.js.map +1 -0
- package/dist/testing/env.d.ts +63 -0
- package/dist/testing/env.js +105 -0
- package/dist/testing/env.js.map +1 -0
- package/dist/testing/fake-chain.d.ts +118 -0
- package/dist/testing/fake-chain.js +536 -0
- package/dist/testing/fake-chain.js.map +1 -0
- package/dist/testing/fake-clock.d.ts +15 -0
- package/dist/testing/fake-clock.js +86 -0
- package/dist/testing/fake-clock.js.map +1 -0
- package/dist/testing/fake-driver.d.ts +15 -0
- package/dist/testing/fake-driver.js +458 -0
- package/dist/testing/fake-driver.js.map +1 -0
- package/dist/testing/fake-fetch.d.ts +32 -0
- package/dist/testing/fake-fetch.js +81 -0
- package/dist/testing/fake-fetch.js.map +1 -0
- package/dist/testing/fake-plugin.d.ts +30 -0
- package/dist/testing/fake-plugin.js +66 -0
- package/dist/testing/fake-plugin.js.map +1 -0
- package/dist/testing/faulty-store.d.ts +36 -0
- package/dist/testing/faulty-store.js +66 -0
- package/dist/testing/faulty-store.js.map +1 -0
- package/dist/testing/generation.d.ts +60 -0
- package/dist/testing/generation.js +252 -0
- package/dist/testing/generation.js.map +1 -0
- package/dist/testing/index.d.ts +28 -0
- package/dist/testing/index.js +51 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +188 -45
- package/dist/libs/eth/account.d.ts +0 -9
- package/dist/libs/eth/account.js +0 -58
- package/dist/libs/eth/account.js.map +0 -1
- package/dist/libs/eth/contract.d.ts +0 -7
- package/dist/libs/eth/contract.js +0 -42
- package/dist/libs/eth/contract.js.map +0 -1
- package/dist/libs/eth/index.d.ts +0 -24
- package/dist/libs/eth/index.js +0 -72
- package/dist/libs/eth/index.js.map +0 -1
- package/dist/libs/eth/transact.d.ts +0 -7
- package/dist/libs/eth/transact.js +0 -26
- package/dist/libs/eth/transact.js.map +0 -1
- package/dist/libs/index.d.ts +0 -2
- package/dist/libs/index.js +0 -19
- package/dist/libs/index.js.map +0 -1
- package/dist/libs/trx/account.d.ts +0 -9
- package/dist/libs/trx/account.js +0 -55
- package/dist/libs/trx/account.js.map +0 -1
- package/dist/libs/trx/contract.d.ts +0 -7
- package/dist/libs/trx/contract.js +0 -27
- package/dist/libs/trx/contract.js.map +0 -1
- package/dist/libs/trx/index.d.ts +0 -22
- package/dist/libs/trx/index.js +0 -64
- package/dist/libs/trx/index.js.map +0 -1
- package/dist/libs/trx/transact.d.ts +0 -7
- package/dist/libs/trx/transact.js +0 -26
- package/dist/libs/trx/transact.js.map +0 -1
- package/dist/tool/common.d.ts +0 -28
- package/dist/tool/common.js +0 -33
- package/dist/tool/common.js.map +0 -1
- package/dist/tool/eth-tools.d.ts +0 -3
- package/dist/tool/eth-tools.js +0 -33
- package/dist/tool/eth-tools.js.map +0 -1
- package/dist/tool/index.d.ts +0 -5
- package/dist/tool/index.js +0 -22
- package/dist/tool/index.js.map +0 -1
- package/dist/tool/logging.d.ts +0 -3
- package/dist/tool/logging.js +0 -11
- package/dist/tool/logging.js.map +0 -1
- package/dist/tool/options.d.ts +0 -6
- package/dist/tool/options.js +0 -41
- package/dist/tool/options.js.map +0 -1
- package/dist/tool/trx-tools.d.ts +0 -3
- package/dist/tool/trx-tools.js +0 -20
- package/dist/tool/trx-tools.js.map +0 -1
- package/dist/type/account.d.ts +0 -9
- package/dist/type/account.js.map +0 -1
- package/dist/type/common.d.ts +0 -18
- package/dist/type/common.js.map +0 -1
- package/dist/type/contract.d.ts +0 -10
- package/dist/type/contract.js.map +0 -1
- package/dist/type/index.d.ts +0 -5
- package/dist/type/index.js +0 -22
- package/dist/type/index.js.map +0 -1
- package/dist/type/lib-types.d.ts +0 -9
- package/dist/type/lib-types.js.map +0 -1
- package/dist/type/transact.d.ts +0 -7
- package/dist/type/transact.js.map +0 -1
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import type { AssetService } from '../assets/service';
|
|
2
|
+
import type { ResolvedSelection } from '../config/types';
|
|
3
|
+
import type { PooledDriver } from '../container/pool';
|
|
4
|
+
import type { BroadcastResult, BuildContext, SequenceSource } from '../driver/types';
|
|
5
|
+
import { ChainError, type CryptoAioError } from '../errors/error';
|
|
6
|
+
import type { EventBus } from '../events/bus';
|
|
7
|
+
import type { Logger } from '../events/logger';
|
|
8
|
+
import { type StoredIntent, type TransferIntent } from '../model/intent';
|
|
9
|
+
import type { FeeOverride, FeeSpeed } from '../model/fee';
|
|
10
|
+
import { type OrderingData } from '../model/ordering';
|
|
11
|
+
import type { AttemptRef, UnsignedTx } from '../model/transaction';
|
|
12
|
+
import { type LeaseHandle, type SequenceCoordinator } from '../ordering/sequence';
|
|
13
|
+
import type { SigningOrchestrator } from '../signing/orchestrator';
|
|
14
|
+
import type { SignatureBundle, SignerTicket, SigningContext, SigningPurpose, SigningRequest } from '../signing/types';
|
|
15
|
+
import type { ResolvedWallet } from '../signing/wallet';
|
|
16
|
+
import { type AttemptPurpose, type AttemptRecord, type ExecutionContext, type Fence, type OperationPatch, type OperationRecord, type OperationState, type Stores } from '../store/types';
|
|
17
|
+
import { type Clock } from '../util/clock';
|
|
18
|
+
import { type ResolvedLifecycle, type RestorePoint } from './engine-rules';
|
|
19
|
+
import { type ObservationDeps } from './observations';
|
|
20
|
+
import * as reconcile from './reconcile';
|
|
21
|
+
/** What read-only lifecycle work (monitoring, waiting) needs: no wallet required. */
|
|
22
|
+
export interface ReadTarget {
|
|
23
|
+
readonly selection: ResolvedSelection;
|
|
24
|
+
readonly pooled: PooledDriver;
|
|
25
|
+
}
|
|
26
|
+
export interface OperationTarget extends ReadTarget {
|
|
27
|
+
readonly wallet: ResolvedWallet;
|
|
28
|
+
readonly assets: AssetService;
|
|
29
|
+
}
|
|
30
|
+
export interface TransferOptions {
|
|
31
|
+
readonly idempotencyKey?: string;
|
|
32
|
+
readonly signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export { LIFECYCLE_DEFAULTS, PRE_SIGNING_STATES, errorCode, rehydrateError, serializeError, withLifecycleDefaults, type ResolvedLifecycle, } from './engine-rules';
|
|
35
|
+
export interface EngineDeps {
|
|
36
|
+
readonly namespace: string;
|
|
37
|
+
readonly stores: Stores;
|
|
38
|
+
readonly events: EventBus;
|
|
39
|
+
readonly clock: Clock;
|
|
40
|
+
readonly log: Logger;
|
|
41
|
+
readonly orchestrator: SigningOrchestrator;
|
|
42
|
+
readonly sequences: SequenceCoordinator;
|
|
43
|
+
readonly lifecycle: () => ResolvedLifecycle;
|
|
44
|
+
}
|
|
45
|
+
export declare class OperationEngine {
|
|
46
|
+
protected readonly deps: EngineDeps;
|
|
47
|
+
constructor(deps: EngineDeps);
|
|
48
|
+
get namespace(): string;
|
|
49
|
+
/** Builds and persists the unsigned transaction; runs the policy hook. Idempotent per key. */
|
|
50
|
+
prepare(target: OperationTarget, intent: TransferIntent, options?: TransferOptions): Promise<OperationRecord>;
|
|
51
|
+
/**
|
|
52
|
+
* Idempotent transfer: prepare → sign → persist the Attempt (write-ahead) → broadcast.
|
|
53
|
+
* A repeat resumes where the Operation stopped and never signs an Attempt twice.
|
|
54
|
+
*/
|
|
55
|
+
transfer(target: OperationTarget, intent: TransferIntent, options?: TransferOptions): Promise<OperationRecord>;
|
|
56
|
+
/**
|
|
57
|
+
* Adds externally produced signatures (cold, offline, MPC); completes and broadcasts once
|
|
58
|
+
* every request is signed. Under the address lease, and the `beforeSign` policy is
|
|
59
|
+
* asked again first (defence in depth): a veto fails the Operation, releases its nonce and
|
|
60
|
+
* cancels its signer tickets, as a veto before signing does.
|
|
61
|
+
*/
|
|
62
|
+
submitSignatures(target: OperationTarget, operationId: string, signatures: readonly SignatureBundle[]): Promise<OperationRecord>;
|
|
63
|
+
/**
|
|
64
|
+
* Resends the SAME stored raw bytes of the active Attempt (never builds or signs), under
|
|
65
|
+
* the address lease. A refused replacement or cancel gives the active role back
|
|
66
|
+
* to the Attempt it superseded (`resendActive`).
|
|
67
|
+
*/
|
|
68
|
+
rebroadcast(target: OperationTarget, operationId: string, signal?: AbortSignal): Promise<OperationRecord>;
|
|
69
|
+
/**
|
|
70
|
+
* Only before any signed bytes exist. Under the address lease: re-reads the
|
|
71
|
+
* Operation, renews the lease (a lost lease fails before any write), marks it
|
|
72
|
+
* `abandoned` and releases its reservation. Pending signer tickets are cancelled after
|
|
73
|
+
* the lease is dropped, even when the release failed.
|
|
74
|
+
*/
|
|
75
|
+
abandon(target: OperationTarget, operationId: string): Promise<OperationRecord>;
|
|
76
|
+
/** Best effort, through the signer that issued each ticket; failures log codes only. */
|
|
77
|
+
protected cancelTickets(target: OperationTarget, operationId: string, tickets: readonly SignerTicket[]): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* A new Attempt paying a higher fee for the same slot (same nonce or seqno,
|
|
80
|
+
* or conflicting inputs). Needs the `replace-fee` capability, the driver's
|
|
81
|
+
* ReplacementPolicy and a synchronous signer; `submitted` or `stalled` only. See
|
|
82
|
+
* `createConflicting`.
|
|
83
|
+
*
|
|
84
|
+
* Idempotent per fee spec. While the active Attempt is a replacement made for the
|
|
85
|
+
* same spec (the same `FeeSpeed` name, or a canonically equal `FeeOverride`), a repeat
|
|
86
|
+
* signs nothing and returns it, resending its stored bytes when their broadcast was never
|
|
87
|
+
* recorded or was ambiguous. A replacement for the same spec that was refused (the
|
|
88
|
+
* superseded Attempt active again) is resent, never signed again; a refusal is thrown,
|
|
89
|
+
* never a success. To bump again, pass another spec (e.g. a higher override).
|
|
90
|
+
*
|
|
91
|
+
* While the active replacement is persisted but unsent (`signed`), another fee spec
|
|
92
|
+
* is refused with INVALID_TRANSITION; repeat the same spec (it is resent) or call
|
|
93
|
+
* `rebroadcast` first.
|
|
94
|
+
*/
|
|
95
|
+
replace(target: OperationTarget, operationId: string, fee: FeeSpeed | FeeOverride): Promise<OperationRecord>;
|
|
96
|
+
/**
|
|
97
|
+
* "Cancel" is a conflicting transaction for the same slot (e.g. a self-transfer), not a
|
|
98
|
+
* protocol primitive: the outcome is `cancelled` only when the cancel Attempt reaches
|
|
99
|
+
* proven finality, and the original may still win. Capability `cancel`; `submitted` or
|
|
100
|
+
* `stalled` only. It pays the driver's minimum bump over the highest-fee earlier cancel
|
|
101
|
+
* (or over the active Attempt when there is none), or `fee` when given (refused below
|
|
102
|
+
* that bump). See `createConflicting`.
|
|
103
|
+
*
|
|
104
|
+
* A repeat while a cancel is the active Attempt resends its stored bytes when their
|
|
105
|
+
* broadcast was never recorded or was ambiguous, and returns it unchanged while a node
|
|
106
|
+
* holds it (`pending`, `mempool`) or once it is on chain; concurrent and retried cancels
|
|
107
|
+
* are idempotent. Only a cancel recorded `refused` or `dropped` is bumped by a repeat
|
|
108
|
+
* (each bump climbs one step from the highest-fee cancel), so a cancel that cannot land
|
|
109
|
+
* never leaves the nonce stuck. When the node's floor is more than one bump away, pass
|
|
110
|
+
* `fee`: an explicit fee always builds a new cancel while none is on chain.
|
|
111
|
+
*
|
|
112
|
+
* While the active replacement is persisted but unsent (`signed`), a cancel is refused
|
|
113
|
+
* with INVALID_TRANSITION; repeat that replacement's fee spec (it is resent) or call
|
|
114
|
+
* `rebroadcast` first.
|
|
115
|
+
*/
|
|
116
|
+
cancel(target: OperationTarget, operationId: string, fee?: FeeSpeed | FeeOverride): Promise<OperationRecord>;
|
|
117
|
+
/**
|
|
118
|
+
* Expiry and seqno chains only: once every earlier Attempt is provably dead (re-proved
|
|
119
|
+
* here from finalized state, `assertAttemptsDead`), an `expired` Operation gets a fresh
|
|
120
|
+
* Attempt and is live again. It is the one explicit exception to "a terminal Operation
|
|
121
|
+
* never moves" (see `appendSigned`). Under the Operation's lease (the op lock on expiry
|
|
122
|
+
* chains, the address lease on seqno chains); signed once, persisted before its
|
|
123
|
+
* broadcast, and a repeat resends a persisted rebuild instead of signing another. On a
|
|
124
|
+
* seqno chain it takes the wallet's next seqno (SEQUENCE_BUSY while another live
|
|
125
|
+
* Operation holds it), and the Operation's `reservation` is refreshed to the rebuilt
|
|
126
|
+
* Attempt's ordering in the same write as the Attempt. A refusal of the rebuilt
|
|
127
|
+
* Attempt leaves the Operation `stalled`, never `expired` again: only the monitor's proof
|
|
128
|
+
* can end it.
|
|
129
|
+
*/
|
|
130
|
+
rebuild(target: OperationTarget, operationId: string): Promise<OperationRecord>;
|
|
131
|
+
get(operationId: string): Promise<OperationRecord | null>;
|
|
132
|
+
require(operationId: string): Promise<OperationRecord>;
|
|
133
|
+
/**
|
|
134
|
+
* The Operation, checked to belong to this handle's chain, network and wallet
|
|
135
|
+
* before anything reads its payload (e.g. `submitSignatures` with a signed payload), so
|
|
136
|
+
* another wallet's Operation never reaches the driver.
|
|
137
|
+
*/
|
|
138
|
+
requireOwned(target: OperationTarget, operationId: string): Promise<OperationRecord>;
|
|
139
|
+
protected open(target: OperationTarget, intent: TransferIntent, options: TransferOptions): Promise<{
|
|
140
|
+
record: OperationRecord;
|
|
141
|
+
stored: StoredIntent;
|
|
142
|
+
}>;
|
|
143
|
+
protected executionContext(target: OperationTarget): ExecutionContext;
|
|
144
|
+
/**
|
|
145
|
+
* Rejects an Operation of another chain, network or sending address: its reservation
|
|
146
|
+
* lives under a different sequence key, which this target's lease must never touch.
|
|
147
|
+
*/
|
|
148
|
+
protected assertOwnedBy(target: OperationTarget, op: OperationRecord): void;
|
|
149
|
+
/**
|
|
150
|
+
* The address lease of `op`'s own sending address (keyed on the Operation, never on
|
|
151
|
+
* the target's wallet, so a write for a stored Operation needs no signer). Any snapshot
|
|
152
|
+
* of the Operation will do: its chain, network and sender never change. Every
|
|
153
|
+
* transition of an Operation that holds a reservation runs under it, and so does the
|
|
154
|
+
* release of that reservation (see `releaseReservation`).
|
|
155
|
+
*/
|
|
156
|
+
protected withAddressLease<T>(target: ReadTarget, op: OperationRecord, fn: (lease: LeaseHandle | undefined) => Promise<T>, signal?: AbortSignal, options?: {
|
|
157
|
+
readonly acquireTimeoutMs?: number;
|
|
158
|
+
}): Promise<T>;
|
|
159
|
+
/**
|
|
160
|
+
* Serializes one Operation's signing transitions: the wallet's address lease where the
|
|
161
|
+
* ordering needs one, otherwise (expiry ordering) a short per-Operation lock, so two
|
|
162
|
+
* same-key repeats can never both sign it. Its handle is passed down (renewed,
|
|
163
|
+
* heartbeat) exactly like the address lease; it never guards a sequence write.
|
|
164
|
+
*/
|
|
165
|
+
protected withOperationLease<T>(target: ReadTarget, op: OperationRecord, fn: (lease: LeaseHandle | undefined) => Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
166
|
+
/** The sequence key of the Operation's own chain, network and sending address. */
|
|
167
|
+
protected sequenceKeyOf(op: Pick<OperationRecord, 'context' | 'intent'>): string;
|
|
168
|
+
protected walletOperations(op: OperationRecord): Promise<OperationRecord[]>;
|
|
169
|
+
protected prepareStage(target: OperationTarget, op: OperationRecord, stored: StoredIntent, lease: LeaseHandle | undefined, signal?: AbortSignal): Promise<OperationRecord>;
|
|
170
|
+
/**
|
|
171
|
+
* `prepare()`'s policy check. Bounded like signing, by `lifecycle.signTimeoutMs` and
|
|
172
|
+
* the caller's `signal` (`signingDeadline`), but with no heartbeat: a hook that outlives
|
|
173
|
+
* the lease loses it, and its veto then writes nothing. Only a veto fails the
|
|
174
|
+
* Operation; a timeout or an abort leaves it `prepared` for a repeat to authorize again.
|
|
175
|
+
*/
|
|
176
|
+
protected authorizeOrFail(target: OperationTarget, op: OperationRecord, lease?: LeaseHandle, signal?: AbortSignal): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Takes an Operation as far as one call can, all under its lease (`withOperationLease`:
|
|
179
|
+
* the address lease, or a per-Operation lock on expiry chains): `created`
|
|
180
|
+
* is prepared, `prepared` is signed into the write-ahead Attempt, and a `signed` (or
|
|
181
|
+
* ambiguously `submitted`) Operation resends its stored raw bytes; it is never signed
|
|
182
|
+
* again. Any other state is returned as it is (`settle` rethrows a stored failure).
|
|
183
|
+
*/
|
|
184
|
+
protected drive(target: OperationTarget, op: OperationRecord, stored: StoredIntent, signal?: AbortSignal): Promise<OperationRecord>;
|
|
185
|
+
/**
|
|
186
|
+
* Runs the policy hook and the signer(s) over the stored unsigned payload, bounded by the
|
|
187
|
+
* lease (`signingDeadline`). A veto or a mismatching signature fails the Operation before
|
|
188
|
+
* signing. A pending result is persisted as `awaiting-signature` with every ticket;
|
|
189
|
+
* a signed one becomes the write-ahead Attempt.
|
|
190
|
+
*/
|
|
191
|
+
protected signStage(target: OperationTarget, op: OperationRecord, lease?: LeaseHandle, signal?: AbortSignal): Promise<OperationRecord>;
|
|
192
|
+
/**
|
|
193
|
+
* Bounds a signer or policy call (they have no deadline of their own) by
|
|
194
|
+
* `lifecycle.signTimeoutMs` and the caller's `signal`, and keeps the held lease alive
|
|
195
|
+
* meanwhile (renewed every `leaseMs / 3`). On timeout, abort or a lost lease nothing
|
|
196
|
+
* is written: the Operation keeps its state and reservation (a late signature may still
|
|
197
|
+
* appear), and a repeat asks again. A lost lease is logged by code, like
|
|
198
|
+
* `failAfterPrepare`. A result that arrives after the wait ended goes to `late` (a
|
|
199
|
+
* pending answer's tickets are cancelled there); otherwise it is dropped.
|
|
200
|
+
*/
|
|
201
|
+
protected signingDeadline<T>(op: OperationRecord, lease: LeaseHandle | undefined, signal: AbortSignal | undefined, work: () => Promise<T>, late?: (result: T) => Promise<void>): Promise<T>;
|
|
202
|
+
/**
|
|
203
|
+
* Renews `lease` every `max(1, leaseMs / 3)` ms until `stop` aborts. Rejects (after a
|
|
204
|
+
* code-only log) when a renewal fails: the lease was lost to another worker.
|
|
205
|
+
*/
|
|
206
|
+
protected heartbeat(op: OperationRecord, lease: LeaseHandle, stop: AbortSignal): Promise<never>;
|
|
207
|
+
/**
|
|
208
|
+
* The persisted partial signatures that still verify. A corrupt entry is
|
|
209
|
+
* dropped (its request is signed or submitted again) instead of making `sign()` or
|
|
210
|
+
* `accept()` throw SIGNATURE_MISMATCH on every call, which would strand the Operation.
|
|
211
|
+
*/
|
|
212
|
+
protected usablePartials(op: OperationRecord, requests: readonly SigningRequest[]): SignatureBundle[];
|
|
213
|
+
/**
|
|
214
|
+
* Assembles and persists an immutable Attempt BEFORE any broadcast (write-ahead). `lease`
|
|
215
|
+
* is renewed right before the write: signing may have outlived it, and then
|
|
216
|
+
* nothing is written. When the append loses its compare-and-set to a writer that took the
|
|
217
|
+
* Operation to `signed` or beyond (or ended it), the stored Operation is returned
|
|
218
|
+
* instead, and callers continue from its state; a still pre-signing one rethrows the
|
|
219
|
+
* VERSION_CONFLICT, and an abandoned one is INVALID_TRANSITION. The `signed` Operation is
|
|
220
|
+
* scheduled (`nextCheckAt: now`), like every engine transition after signing.
|
|
221
|
+
*
|
|
222
|
+
* A new Attempt (`supersedes` set: replace, cancel, rebuild) has a stricter lost-CAS
|
|
223
|
+
* contract: the stored Operation is returned only when it shows this very Attempt;
|
|
224
|
+
* otherwise the VERSION_CONFLICT is rethrown (`signNewAttempt` may retry it).
|
|
225
|
+
*
|
|
226
|
+
* The store does not guard transitions, so appending to a terminal Operation is refused
|
|
227
|
+
* here, with one explicit exception: a `rebuild` Attempt reopens an `expired` Operation
|
|
228
|
+
* (`rebuild` re-proves every earlier Attempt dead under the lease first). It is
|
|
229
|
+
* the only way out of a terminal state; `update` refuses every other.
|
|
230
|
+
*
|
|
231
|
+
* An Attempt whose ref another Operation of the namespace holds is never appended
|
|
232
|
+
* (`withRefFree`); an original one fails its Operation and keeps its nonce.
|
|
233
|
+
*/
|
|
234
|
+
protected appendSigned(target: OperationTarget, op: OperationRecord, unsigned: UnsignedTx, signatures: readonly SignatureBundle[], purpose: SigningPurpose, supersedes?: string, lease?: LeaseHandle): Promise<OperationRecord>;
|
|
235
|
+
/**
|
|
236
|
+
* Runs `append` only when no other Operation of this namespace holds `ref`, live or
|
|
237
|
+
* terminal (a terminal holder's bytes are already on chain): a second Operation
|
|
238
|
+
* recording the same bytes would inherit their outcome, reporting success for a payment
|
|
239
|
+
* that never moved. The check and the append run under a short lease on the ref, so two
|
|
240
|
+
* processes sharing the lock manager cannot both pass it; it is always the innermost
|
|
241
|
+
* lease, so it cannot deadlock with the address or Operation lease held around it. This
|
|
242
|
+
* also needs `findByRef` to be read-your-writes consistent across those processes (no
|
|
243
|
+
* read replica or eventually consistent index) and the append to finish within
|
|
244
|
+
* `leaseMs`. The held `lease` is renewed inside it, right before the write. A ref lease
|
|
245
|
+
* still held elsewhere after `leaseMs / 3`, a bound that keeps the wait within the held
|
|
246
|
+
* lease, is `SEQUENCE_BUSY` with its own fixed text (the coordinator's text names the
|
|
247
|
+
* address lease).
|
|
248
|
+
*/
|
|
249
|
+
protected withRefFree<T>(op: OperationRecord, ref: AttemptRef, lease: LeaseHandle | undefined, append: () => Promise<T>): Promise<T>;
|
|
250
|
+
protected activeAttempt(op: OperationRecord): AttemptRecord;
|
|
251
|
+
/**
|
|
252
|
+
* Replace and cancel, under the Operation's lease (the address lease; the op lock on
|
|
253
|
+
* expiry chains). The new Attempt is built from the active one and must be mutually
|
|
254
|
+
* exclusive with every earlier Attempt (checked before signing; for inputs, exclusion is
|
|
255
|
+
* not transitive) and use the slot `assertBuiltOrdering` expects. It is signed once and
|
|
256
|
+
* persisted before its broadcast (`signNewAttempt`), never re-signed: a repeat whose
|
|
257
|
+
* Attempt was persisted but never, or ambiguously, sent resends its stored bytes
|
|
258
|
+
* (`resumeNewAttempt`). When the node refuses the fresh Attempt, the one it superseded is
|
|
259
|
+
* still live: the Operation goes back to its previous state and active Attempt
|
|
260
|
+
* (`restoreAfterRefusal`) and the node's error is thrown. That refusal is never terminal.
|
|
261
|
+
*
|
|
262
|
+
* A repeat of an earlier request (`fee` is the requested spec): the same
|
|
263
|
+
* replacement spec is answered by that replacement (`repeatReplacement`); a cancel is
|
|
264
|
+
* resent, returned, or bumped when refused or dropped (`repeatCancel`). See `replace` and
|
|
265
|
+
* `cancel`.
|
|
266
|
+
*/
|
|
267
|
+
protected createConflicting(target: OperationTarget, operationId: string, purpose: 'replacement' | 'cancel', fee: FeeSpeed | FeeOverride | undefined, build: (previous: UnsignedTx, ctx: BuildContext) => Promise<UnsignedTx>): Promise<OperationRecord>;
|
|
268
|
+
/**
|
|
269
|
+
* The replacement a repeat of this fee spec refers to: the active one made for it,
|
|
270
|
+
* or the latest Attempt when it was made for it and, refused, gave the active role back to
|
|
271
|
+
* the Attempt it superseded. `undefined`: a new request.
|
|
272
|
+
*/
|
|
273
|
+
protected priorReplacement(op: OperationRecord, fee: FeeSpeed | FeeOverride | undefined): AttemptRecord | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* A repeat of the request `prior` was made for signs nothing. Its stored bytes are
|
|
276
|
+
* resent when their broadcast was never recorded, was ambiguous, or was refused or
|
|
277
|
+
* rejected: the node's current answer decides, and a refusal restores the
|
|
278
|
+
* superseded Attempt and is thrown (`resendActive`), never reported as a success. A
|
|
279
|
+
* `prior` that already gave the active role back is resent first and made active again
|
|
280
|
+
* only once the node accepted it (`resendRestoredAway`). An active `prior` the node holds,
|
|
281
|
+
* or one on chain, is returned as it is. `undefined` (a refused `prior` of an Operation
|
|
282
|
+
* that moved on): the caller goes on as for a new request.
|
|
283
|
+
*/
|
|
284
|
+
protected repeatReplacement(target: OperationTarget, op: OperationRecord, prior: AttemptRecord, lease: LeaseHandle | undefined): Promise<OperationRecord | undefined>;
|
|
285
|
+
/**
|
|
286
|
+
* Resends the stored bytes of a replacement that gave the active role back after a
|
|
287
|
+
* refusal, while the Attempt it superseded stays active. Only once a node accepted them
|
|
288
|
+
* (or they are already seen) is it made active again (`reactivate`) and the acceptance
|
|
289
|
+
* recorded, so a crash in between leaves the superseded Attempt active and never an
|
|
290
|
+
* unaccepted one. A refusal or rejection is thrown and changes nothing; an ambiguous
|
|
291
|
+
* failure leaves the may-be-live marker (`recordAmbiguous`).
|
|
292
|
+
*/
|
|
293
|
+
protected resendRestoredAway(target: OperationTarget, op: OperationRecord, prior: AttemptRecord, lease: LeaseHandle | undefined): Promise<OperationRecord>;
|
|
294
|
+
/**
|
|
295
|
+
* Makes a refused new Attempt active again, only while the Attempt it superseded is still
|
|
296
|
+
* the active one and nothing was appended since (compare-and-set, re-derived after a lost
|
|
297
|
+
* one). Otherwise VERSION_CONFLICT (retryable).
|
|
298
|
+
*/
|
|
299
|
+
protected reactivate(op: OperationRecord, attempt: AttemptRecord, lease: LeaseHandle | undefined): Promise<OperationRecord>;
|
|
300
|
+
/**
|
|
301
|
+
* A cancel while a cancel is the active Attempt. Its stored bytes are resent when
|
|
302
|
+
* their broadcast was never recorded or was ambiguous; it is returned unchanged while a
|
|
303
|
+
* node holds it (`pending`, `mempool`) and once it is on chain (chain evidence), so
|
|
304
|
+
* concurrent and retried cancels are idempotent. `undefined` asks the caller for a new,
|
|
305
|
+
* bumped cancel: only when the cancel is recorded `refused`, `rejected` or
|
|
306
|
+
* `dropped`, or for an explicit `fee` while it is not on chain. A refused or rejected one
|
|
307
|
+
* first gives the active role back to the Attempt it superseded, so it is never
|
|
308
|
+
* reported as a success.
|
|
309
|
+
*/
|
|
310
|
+
protected repeatCancel(target: OperationTarget, op: OperationRecord, active: AttemptRecord, fee: FeeSpeed | FeeOverride | undefined, lease: LeaseHandle | undefined): Promise<OperationRecord | undefined>;
|
|
311
|
+
/**
|
|
312
|
+
* A repeat of a replace, cancel or rebuild whose Attempt was persisted but never sent (no
|
|
313
|
+
* broadcast recorded: a crash after `appendAttempt`) or sent with an unknown outcome
|
|
314
|
+
* (ambiguous): its stored bytes are resent, never signed again, so a retry creates no
|
|
315
|
+
* second new Attempt. `undefined` when there is nothing to resume.
|
|
316
|
+
*
|
|
317
|
+
* The resend goes through `resendActive`: a refusal restores the superseded Attempt.
|
|
318
|
+
*/
|
|
319
|
+
protected resumeNewAttempt(target: OperationTarget, op: OperationRecord, purpose: Exclude<AttemptPurpose, 'original'>, lease: LeaseHandle | undefined): Promise<OperationRecord | undefined>;
|
|
320
|
+
/**
|
|
321
|
+
* Resends the active Attempt's stored bytes (`broadcastActive`) for every resend path:
|
|
322
|
+
* `rebroadcast` (and so recovery), a same-key `transfer` and a repeated replace, cancel or
|
|
323
|
+
* rebuild. When the node refuses a resent replacement or cancel, the Attempt it
|
|
324
|
+
* superseded becomes active again (`undoRefusedResend`) and the refusal is thrown, so it is
|
|
325
|
+
* never reported as a success. A refused rebuild stays `stalled` (see `rebuild`).
|
|
326
|
+
*/
|
|
327
|
+
protected resendActive(target: OperationTarget, op: OperationRecord, signal: AbortSignal | undefined, lease: LeaseHandle | undefined): Promise<OperationRecord>;
|
|
328
|
+
/**
|
|
329
|
+
* After a resend of a replacement or cancel was refused, the Attempt it superseded
|
|
330
|
+
* becomes active again. The state it was appended over is not recorded, so it is derived
|
|
331
|
+
* from the superseded Attempt's observation: when that one may still be live (`pending`,
|
|
332
|
+
* `mempool`, `included`), the Operation returns to `submitted`; otherwise (e.g. the
|
|
333
|
+
* original was itself refused) only the active Attempt is swapped and the Operation keeps
|
|
334
|
+
* its `stalled` state and stored error. Nothing for an original or a rebuild.
|
|
335
|
+
*/
|
|
336
|
+
protected undoRefusedResend(operationId: string, refused: AttemptRecord, lease: LeaseHandle | undefined): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* Signs a new Attempt once and persists it (write-ahead) before any broadcast. The policy
|
|
339
|
+
* hook and the signer are bounded by `lifecycle.signTimeoutMs`, with the lease renewed
|
|
340
|
+
* meanwhile (`signingDeadline`). A pending answer is refused, since new Attempts need a
|
|
341
|
+
* synchronous signer, and its tickets are cancelled through their issuers, as are
|
|
342
|
+
* those of a pending answer that arrives after the deadline. A veto, a timeout or a bad
|
|
343
|
+
* signature writes nothing.
|
|
344
|
+
*
|
|
345
|
+
* A lost compare-and-set (e.g. a worker's claim bumped the version) is retried with the
|
|
346
|
+
* same signatures under the same lease while the re-read Operation is still `eligible`
|
|
347
|
+
* with the same Attempts. Otherwise the VERSION_CONFLICT is rethrown and these bytes,
|
|
348
|
+
* never persisted or sent, are dropped. Success is returned only when the stored
|
|
349
|
+
* Operation shows the new Attempt (`appendSigned`): `signed`, together with `before`, the
|
|
350
|
+
* snapshot the successful append was made over (what a refusal restores).
|
|
351
|
+
*/
|
|
352
|
+
protected signNewAttempt(target: OperationTarget, op: OperationRecord, unsigned: UnsignedTx, purpose: Exclude<AttemptPurpose, 'original'>, eligible: ReadonlySet<OperationState>, lease: LeaseHandle | undefined): Promise<{
|
|
353
|
+
readonly signed: OperationRecord;
|
|
354
|
+
readonly before: OperationRecord;
|
|
355
|
+
}>;
|
|
356
|
+
/**
|
|
357
|
+
* The node refused a replacement or cancel, so the Attempt it superseded is
|
|
358
|
+
* still the live one and keeps its nonce. While the refused Attempt is still the active
|
|
359
|
+
* one and the Operation is not terminal (an ended Operation is left alone),
|
|
360
|
+
* the superseded one becomes active again. When the Operation still shows the refusal
|
|
361
|
+
* (`stalled`, or `signed` after a rejection) and `point` names a state, it also returns
|
|
362
|
+
* to `point`'s state, error and ambiguity; any other state (`included`, `submitted` or
|
|
363
|
+
* later) is the monitor's and is kept. The refused Attempt stays recorded and monitored.
|
|
364
|
+
* The lease is renewed first. A failure is only logged: the caller gets the node's error
|
|
365
|
+
* either way, and the Operation stays safely `stalled`.
|
|
366
|
+
*/
|
|
367
|
+
protected restoreAfterRefusal(operationId: string, refusedId: string | undefined, point: RestorePoint, lease: LeaseHandle | undefined): Promise<void>;
|
|
368
|
+
/**
|
|
369
|
+
* Rebuild's precondition, re-proved from finalized state (quorum proof reads), never
|
|
370
|
+
* taken from stored observations: each earlier Attempt's expiry passed, or (seqno)
|
|
371
|
+
* another transaction consumed its slot, per finalized state, and only then is it
|
|
372
|
+
* confirmed not included at finality. In that order, as the monitor does: any inclusion
|
|
373
|
+
* would lie at or below the already finalized expiry or slot, so the later read sees it.
|
|
374
|
+
* Otherwise INVALID_TRANSITION; nothing is written.
|
|
375
|
+
*/
|
|
376
|
+
protected assertAttemptsDead(target: OperationTarget, op: OperationRecord): Promise<void>;
|
|
377
|
+
/**
|
|
378
|
+
* The wallet's next seqno as a reservation. Seqno wallets are strictly serial: another
|
|
379
|
+
* live Operation that may still consume the current seqno makes this SEQUENCE_BUSY.
|
|
380
|
+
*/
|
|
381
|
+
protected nextSeqno(sequence: SequenceSource, op: OperationRecord): Promise<OrderingData>;
|
|
382
|
+
protected get observationDeps(): ObservationDeps;
|
|
383
|
+
/**
|
|
384
|
+
* Sends the active Attempt's stored raw bytes. `lease` is the held address lease (every
|
|
385
|
+
* caller holds it; leases are not reentrant): a rejection's terminal write and
|
|
386
|
+
* release run under it.
|
|
387
|
+
*/
|
|
388
|
+
protected broadcastActive(target: OperationTarget, op: OperationRecord, signal?: AbortSignal, lease?: LeaseHandle): Promise<OperationRecord>;
|
|
389
|
+
/**
|
|
390
|
+
* The broadcast may have reached the network: a transport failure, an RPC error after a
|
|
391
|
+
* possibly delivered attempt (`ambiguous`), or a caller abort (which the transport
|
|
392
|
+
* surfaces bare). The Operation becomes `submitted` + `ambiguous` and is monitored; it is
|
|
393
|
+
* never failed and keeps its reservation. A retry with the same key resends the stored
|
|
394
|
+
* bytes. The observation is written first and on its own, then the transition, re-derived
|
|
395
|
+
* after a lost compare-and-set; a store failure is only logged: the caller must get the
|
|
396
|
+
* ambiguous error.
|
|
397
|
+
* `ambiguous: true` means the outcome is unknown and the caller retries
|
|
398
|
+
* with the same idempotency key; the error keeps its code and that code's retryability.
|
|
399
|
+
*/
|
|
400
|
+
protected recordAmbiguous(op: OperationRecord, attempt: AttemptRecord, error: unknown, signal?: AbortSignal): Promise<CryptoAioError>;
|
|
401
|
+
/**
|
|
402
|
+
* Accepted / already-known → `submitted` (an `included` Operation is never
|
|
403
|
+
* downgraded); the acceptance is remembered on the observation (`firstSeenAt`). refused
|
|
404
|
+
* and rejected → the Attempt's own ref is looked up first (seen means it was ours all
|
|
405
|
+
* along). An `included` Operation, or an Attempt whose observation holds chain
|
|
406
|
+
* evidence (mined, replaced or expired), is never stalled, failed or released by a later
|
|
407
|
+
* answer, and a rejection of bytes a node once accepted counts only as a refusal.
|
|
408
|
+
* Otherwise refused → `stalled`, keeping the nonce; rejected (proven invalid) → `failed`
|
|
409
|
+
* with the nonce released, once every Attempt is rejected.
|
|
410
|
+
*
|
|
411
|
+
* The node's own refusal or rejection is thrown as it is; any other failure while
|
|
412
|
+
* recording the answer (the bytes may have reached the network) is thrown `ambiguous`
|
|
413
|
+
* with `operationId`, so a caller retries with the same key instead of paying again.
|
|
414
|
+
*/
|
|
415
|
+
protected applyBroadcastResult(target: OperationTarget, op: OperationRecord, attempt: AttemptRecord, result: BroadcastResult, lease?: LeaseHandle): Promise<OperationRecord>;
|
|
416
|
+
/** `applyBroadcastResult`'s transitions; returns (never throws) the node's own answer. */
|
|
417
|
+
protected recordBroadcastResult(target: OperationTarget, op: OperationRecord, attempt: AttemptRecord, result: BroadcastResult, lease?: LeaseHandle): Promise<OperationRecord | ChainError>;
|
|
418
|
+
/**
|
|
419
|
+
* The all-rejected verdict. Once every Attempt is proven `rejected`, no valid
|
|
420
|
+
* signed bytes exist for the nonce: the Operation fails and the nonce is released in the
|
|
421
|
+
* same step, under the address lease, whoever reaches the verdict (the
|
|
422
|
+
* broadcast path or the monitor). Under the lease it re-reads the Operation, re-checks
|
|
423
|
+
* the verdict and renews the lease before the terminal compare-and-set; a lost lease or a
|
|
424
|
+
* verdict that no longer holds writes nothing and returns the stored Operation. Pass the
|
|
425
|
+
* held lease when already inside `withAddressLease` (it is not re-entrant).
|
|
426
|
+
*
|
|
427
|
+
* Without a held lease (the monitor), the lease wait is bounded by `signal` as well as
|
|
428
|
+
* `acquireTimeoutMs` (the option overrides it; `0` tries once); a busy lease, or a target
|
|
429
|
+
* whose wallet no longer owns the Operation (e.g. re-pointed to another key), writes
|
|
430
|
+
* nothing, logs the code and returns `op`. An abort is rethrown. A worker passes its
|
|
431
|
+
* claim `fence`: the terminal write carries it, and a claim taken over by another worker
|
|
432
|
+
* (FENCING) writes nothing, logs the code and returns the stored Operation.
|
|
433
|
+
*/
|
|
434
|
+
failRejected(target: OperationTarget, op: OperationRecord, options?: {
|
|
435
|
+
readonly lease?: LeaseHandle;
|
|
436
|
+
readonly error?: CryptoAioError;
|
|
437
|
+
readonly signal?: AbortSignal;
|
|
438
|
+
readonly acquireTimeoutMs?: number;
|
|
439
|
+
readonly fence?: Fence;
|
|
440
|
+
}): Promise<OperationRecord>;
|
|
441
|
+
/** Nonce reconciliation under the address lease; see `reconcileNonces` in `./reconcile`. */
|
|
442
|
+
reconcileNonces(target: OperationTarget, op: OperationRecord, options?: {
|
|
443
|
+
readonly signal?: AbortSignal;
|
|
444
|
+
readonly acquireTimeoutMs?: number;
|
|
445
|
+
}): Promise<readonly bigint[]>;
|
|
446
|
+
/** The engine's steps that `./reconcile` runs, bound to this engine. */
|
|
447
|
+
protected reconciler(): reconcile.Reconciler;
|
|
448
|
+
protected everyAttemptRejected(op: OperationRecord): Promise<boolean>;
|
|
449
|
+
/**
|
|
450
|
+
* A post-broadcast Operation write. After a lost compare-and-set the Operation is
|
|
451
|
+
* re-read and `patchFor` re-derives the transition from it; `undefined` means the stored
|
|
452
|
+
* state already reflects it (or it no longer applies), and the stored Operation is
|
|
453
|
+
* returned.
|
|
454
|
+
*/
|
|
455
|
+
protected updateAfterBroadcast(op: OperationRecord, patchFor: (current: OperationRecord) => OperationPatch | undefined | Promise<OperationPatch | undefined>): Promise<OperationRecord>;
|
|
456
|
+
/**
|
|
457
|
+
* A failure after the bytes may have reached the network is always an
|
|
458
|
+
* ambiguous STATE_UNRECORDED (retryable by its catalogue entry, so no other code's
|
|
459
|
+
* retryability is overridden), naming the Operation and the original code.
|
|
460
|
+
*/
|
|
461
|
+
protected ambiguousAfterBroadcast(op: OperationRecord, attempt: AttemptRecord, error: unknown): CryptoAioError;
|
|
462
|
+
/**
|
|
463
|
+
* Before a refusal or rejection is believed, looks the Attempt's own ref up.
|
|
464
|
+
* A failed lookup decides nothing: the Operation is scheduled for the monitor (as the
|
|
465
|
+
* ambiguous path does) and the error names it.
|
|
466
|
+
*/
|
|
467
|
+
protected seenOwnRef(target: OperationTarget, op: OperationRecord, attempt: AttemptRecord, now: number): Promise<boolean>;
|
|
468
|
+
/**
|
|
469
|
+
* Terminal failure before any signed bytes exist (after signing, see `failRejected`):
|
|
470
|
+
* mark failed, then free the nonce, both under one address lease. Callers already inside `withAddressLease` must pass their lease (it is not
|
|
471
|
+
* re-entrant); a caller without one gets it acquired first (acquire → renew → CAS →
|
|
472
|
+
* release, never CAS before acquire). The lease is renewed first: when it was lost (a
|
|
473
|
+
* slow policy hook or signer outlived it), nothing is written, the Operation keeps its
|
|
474
|
+
* state, its next repeat retries under a fresh lease, and the original `error` is
|
|
475
|
+
* rethrown. Returning means the terminal write landed; a failed release after it is only
|
|
476
|
+
* logged (callers rethrow their own error either way). Logs carry codes only. With
|
|
477
|
+
* `release: false` (a held ref) the nonce is kept: signed bytes of another Operation
|
|
478
|
+
* may use it.
|
|
479
|
+
*/
|
|
480
|
+
protected failAfterPrepare(target: OperationTarget, op: OperationRecord, error: unknown, lease?: LeaseHandle, options?: {
|
|
481
|
+
readonly release?: boolean;
|
|
482
|
+
}): Promise<OperationRecord>;
|
|
483
|
+
/**
|
|
484
|
+
* Returns the Operation's reserved nonce under the held address lease. Call at most once
|
|
485
|
+
* per allocation, only after the Operation's terminal CAS made under that same lease.
|
|
486
|
+
* There is no lease-less fallback: acquiring a lease only after the CAS could fail and
|
|
487
|
+
* leak the nonce, so a missing lease for a nonce is a programming error.
|
|
488
|
+
*/
|
|
489
|
+
protected releaseReservation(op: OperationRecord, lease: LeaseHandle | undefined): Promise<void>;
|
|
490
|
+
protected signingContext(target: OperationTarget, op: OperationRecord, unsigned: UnsignedTx, purpose: SigningPurpose): SigningContext;
|
|
491
|
+
/**
|
|
492
|
+
* Version-checked (and optionally fenced) state change; emits `operation.state` on
|
|
493
|
+
* transitions. The store does not guard transitions, so this refuses to move a terminal
|
|
494
|
+
* Operation to any other state (the version check makes `op.state` the stored state).
|
|
495
|
+
*/
|
|
496
|
+
update(op: OperationRecord, patch: OperationPatch, fence?: Fence): Promise<OperationRecord>;
|
|
497
|
+
protected emitState(record: OperationRecord, from: OperationState | null): void;
|
|
498
|
+
/** Repeats of failed or stalled Operations surface the same error as the original call. */
|
|
499
|
+
protected settle(op: OperationRecord): OperationRecord;
|
|
500
|
+
}
|