crypto-aio 0.0.2 → 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/lib-types.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/adapters/ton/types.js +3 -0
- 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/core/model/transaction.js +3 -0
- 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 -44
- 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 -2
- package/dist/libs/eth/contract.js +0 -7
- package/dist/libs/eth/contract.js.map +0 -1
- package/dist/libs/eth/index.d.ts +0 -20
- package/dist/libs/eth/index.js +0 -62
- package/dist/libs/eth/index.js.map +0 -1
- package/dist/libs/eth/transact.d.ts +0 -2
- package/dist/libs/eth/transact.js +0 -7
- package/dist/libs/eth/transact.js.map +0 -1
- package/dist/libs/index.d.ts +0 -1
- package/dist/libs/index.js +0 -18
- package/dist/libs/index.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 -4
- package/dist/tool/index.js +0 -21
- 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 -4
- package/dist/tool/options.js +0 -28
- package/dist/tool/options.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/index.d.ts +0 -3
- package/dist/type/index.js +0 -20
- package/dist/type/index.js.map +0 -1
- package/dist/type/lib-types.d.ts +0 -7
- package/dist/type/lib-types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.js","sourceRoot":"","sources":["../../../src/adapters/evm/reader.ts"],"names":[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C,OAAO,EAAE,QAAQ,EAAE,eAAO,CAAC;KAC5E,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY,CAAC,MAAiB;IAC5C,OAAO;QACL,GAAG,EAAE;YACH,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,GAAG,QAAQ,EAAE,EAAE;gBAC5C,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBAC9C,MAAM,IAAI,uBAAe,CACvB,gBAAgB,EAChB,qCAAqC,CACtC,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;gBAC5C,OAAO,MAAM,CAAC,mBAAmB,CAC/B,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,SAAS,EAClC,KAAK,EACL,YAAI,CACL,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * EVM addresses, reads, nonces, finality and the `ext.evm` API. Every call carries the tags\n * of the `ChainDriver` contract table (`src/core/driver/types.ts`): `read` for point\n * queries, `monitor` for heights, observations and nonces, and `proof` for the finality\n * that proofs attest.\n */\nimport type {\n AddressCodec,\n ChainReader,\n DriverBlock,\n SequenceSource,\n} from '../../core/driver/types';\nimport {\n ProviderError,\n ValidationError,\n isCryptoAioError,\n withContext,\n} from '../../core/errors/error';\nimport type { Logger } from '../../core/events/logger';\nimport type { AssetMetadata, AssetRef, TokenRef } from '../../core/model/asset';\nimport type { ChainInfo, NetworkInfo } from '../../core/model/chain';\nimport { quantity } from './client';\nimport { chainObservation, decodeTransaction, evmObservation } from './decode';\nimport type { EvmNetworkConfig } from './network';\nimport type { EvmBlock, EvmCallTags, EvmClient, EvmExt } from './types';\n\n/** What every EVM port is built from. */\nexport interface EvmContext {\n readonly client: EvmClient;\n readonly chain: ChainInfo;\n readonly network: NetworkInfo;\n readonly config: EvmNetworkConfig;\n readonly log: Logger;\n}\n\nexport const READ: EvmCallTags = { purpose: 'read', retry: 'safe' };\nexport const MONITOR: EvmCallTags = { purpose: 'monitor', retry: 'safe' };\nexport const PROOF: EvmCallTags = { purpose: 'proof', retry: 'safe', quorum: 'proof' };\n\nexport const withSignal = (tags: EvmCallTags, signal?: AbortSignal): EvmCallTags =>\n signal ? { ...tags, signal } : tags;\n\nexport function toDriverBlock(block: EvmBlock): DriverBlock {\n return {\n height: block.number,\n hash: block.hash,\n parentHash: block.parentHash,\n timestamp: block.timestamp,\n transactionIds: block.transactions,\n };\n}\n\n/** Whether a definitive (non-ambiguous) JSON-RPC error says the call reverted. */\nexport function isRevert(error: unknown): boolean {\n if (!isCryptoAioError(error, 'RPC_ERROR') || error.ambiguous) return false;\n const { rpcCode, rpcMessage } = error.details ?? {};\n return rpcCode === 3 || /revert/i.test(String(rpcMessage ?? error.message));\n}\n\n/**\n * How many blocks a proof's final height trails the one endpoint that proposed it, so\n * a quorum peer up to this far behind that endpoint still attests it.\n */\nexport const PEER_SKEW = 2n;\n\n/** `height - depth`, or genesis. */\nconst below = (height: bigint, depth: bigint): bigint =>\n height > depth ? height - depth : 0n;\n\n/**\n * A quorum key under which every endpoint whose block is at or past `height` agrees,\n * so honest endpoints at different heights agree, and one that is not there disagrees.\n * A malformed answer throws, which the transport counts as a disagreement.\n */\nconst atOrPast =\n (height: bigint) =>\n (result: unknown): boolean =>\n result !== null &&\n quantity((result as { readonly number?: unknown }).number, 'block number') >= height;\n\n/** Whether every quorum endpoint's `finalized` block is at or past `height`. */\nasync function finalizedAtOrPast(\n ctx: EvmContext,\n height: bigint,\n tags: EvmCallTags,\n): Promise<boolean> {\n const block = await ctx.client.getBlock('finalized', {\n ...tags,\n quorumKey: atOrPast(height),\n });\n // The endpoints agreed on the predicate, so the first one's block states it for all.\n return block !== null && block.number >= height;\n}\n\n/**\n * The highest final block as one endpoint sees it (a `monitor` view): the `finalized` tag,\n * or the head minus the confirmations; the head read carries the signal of `tags`. Proofs\n * never use it as a final height: `provenFinal` attests one.\n */\nexport async function finalizedHeight(\n ctx: EvmContext,\n tags: EvmCallTags,\n): Promise<bigint> {\n const { finality } = ctx.config;\n if (finality.kind === 'confirmations') {\n const head = await ctx.client.blockNumber(withSignal(MONITOR, tags.signal));\n return below(head, BigInt(finality.confirmations - 1));\n }\n const block = await ctx.client.getBlock('finalized', tags);\n if (!block) {\n throw new ProviderError(\n 'PROVIDER_UNAVAILABLE',\n 'the endpoint reports no finalized block',\n );\n }\n return block.number;\n}\n\n/**\n * A height that is final on every endpoint of the proof quorum (`tags`), and the quorum's\n * block at it when the proof read that block anyway. One endpoint's view (a `monitor` read)\n * only proposes: the height trails it by `PEER_SKEW` blocks, and the quorum attests it. On\n * tag networks every quorum endpoint's `finalized` block must be at or past it; on\n * confirmation networks every one must hold the block that confirms it. So an\n * endpoint that over-reports cannot advance finality, and a peer that trails the proposer\n * by up to `PEER_SKEW` blocks still agrees.\n */\nexport async function provenFinal(\n ctx: EvmContext,\n tags: EvmCallTags,\n): Promise<{ readonly height: bigint; readonly block?: EvmBlock }> {\n const { finality } = ctx.config;\n const view = withSignal(MONITOR, tags.signal);\n if (finality.kind === 'confirmations') {\n const confirming = below(await ctx.client.blockNumber(view), PEER_SKEW);\n const block = await ctx.client.getBlock(confirming, tags);\n if (block?.number !== confirming) {\n throw new ProviderError(\n 'PROVIDER_INCONSISTENT',\n 'the endpoints do not hold the confirming block',\n );\n }\n const height = below(confirming, BigInt(finality.confirmations - 1));\n return height === confirming ? { height, block } : { height };\n }\n const height = below(await finalizedHeight(ctx, view), PEER_SKEW);\n if (!(await finalizedAtOrPast(ctx, height, tags))) {\n throw new ProviderError(\n 'PROVIDER_INCONSISTENT',\n 'the endpoints do not attest the proposed finalized block',\n );\n }\n return { height };\n}\n\n/**\n * The quorum's block at `height` when `height` is final on every endpoint of the proof\n * quorum (`tags`), else `null`. Anchored at `height` itself, not at any endpoint's view:\n * honest endpoints disagree only while `height` is final on one and not yet on another, and\n * that decides nothing (a retryable `PROVIDER_INCONSISTENT`).\n */\nexport async function finalBlockAt(\n ctx: EvmContext,\n height: bigint,\n tags: EvmCallTags,\n): Promise<EvmBlock | null> {\n const { client } = ctx;\n const { finality } = ctx.config;\n if (finality.kind === 'tag') {\n if (!(await finalizedAtOrPast(ctx, height, tags))) return null;\n return client.getBlock(height, tags);\n }\n // The block that gives `height` its confirmations; with one, it is `height`'s own.\n const depth = BigInt(finality.confirmations - 1);\n const confirming = await client.getBlock(height + depth, tags);\n if (confirming === null) return null;\n return depth === 0n ? confirming : client.getBlock(height, tags);\n}\n\nexport function createEvmAddressCodec(client: EvmClient): AddressCodec {\n return {\n validate: (value) => client.isAddress(value),\n normalize: (value) => {\n if (!client.isAddress(value)) {\n throw new ValidationError('INVALID_ADDRESS', 'not an EVM address');\n }\n const canonical = client.checksum(value);\n return { canonical, display: canonical };\n },\n fromPublicKey: (publicKey) => {\n // The client's strict decode already throws a specific `INVALID_ADDRESS`.\n const canonical = client.addressFromPublicKey(publicKey);\n return { canonical, display: canonical };\n },\n };\n}\n\nconst assetError = (reason: string) => new ValidationError('ASSET_RESOLUTION', reason);\n\n/** geth's texts for an EVM that stopped the called code itself (`core/vm/errors.go`). */\nconst VM_FAILURE =\n /^(out of gas|invalid opcode|invalid jump destination|stack (underflow|limit reached)|write protection|return data out of bounds)/i;\n\n/** Whether a definitive (non-ambiguous) JSON-RPC error says the EVM stopped the code. */\nexport function isExecutionFailure(error: unknown): boolean {\n if (!isCryptoAioError(error, 'RPC_ERROR') || error.ambiguous) return false;\n const { rpcMessage } = error.details ?? {};\n return typeof rpcMessage === 'string' && VM_FAILURE.test(rpcMessage);\n}\n\n/** An ERC-20 `balanceOf` at `latest`; `ASSET_RESOLUTION` when the contract gives none. */\nexport async function erc20Balance(\n client: EvmClient,\n token: string,\n owner: string,\n tags: EvmCallTags,\n): Promise<bigint> {\n const data = await client.call(\n { to: token, data: client.abi.encodeBalanceOf(owner) },\n 'latest',\n tags,\n );\n try {\n return client.abi.decodeUint256(data);\n } catch {\n throw assetError('the token contract returned no balance');\n }\n}\n\nfunction tokenOf(asset: AssetRef): string {\n if (asset === 'native' || asset.standard !== 'erc20') {\n throw assetError(`EVM tokens use the 'erc20' standard`);\n }\n return asset.contract;\n}\n\n/** The text of an ABI `string`, or of a `bytes32` (older tokens such as MKR return one). */\nfunction symbolText(client: EvmClient, data: string): string {\n try {\n return client.abi.decodeString(data);\n } catch {\n if (!/^0x[0-9a-fA-F]{64}$/.test(data))\n throw assetError('the token symbol is unreadable');\n return Buffer.from(data.slice(2), 'hex').toString('utf8').replace(/\\0+$/, '');\n }\n}\n\n/**\n * Token metadata is read under the proof quorum, stricter than the contract table's\n * minimum. The core caches it for the container's life, and one endpoint's wrong `decimals`\n * (a lagging, misrouted or buggy backend) would mis-scale every amount by orders of\n * magnitude until restart. `decimals` never changes, so honest endpoints always agree.\n */\nconst METADATA: EvmCallTags = { ...READ, quorum: 'proof' };\n\nexport function createEvmReader(ctx: EvmContext): ChainReader {\n const { client } = ctx;\n /**\n * A revert or a VM execution failure is the token's own permanent problem\n * (`ASSET_RESOLUTION`, which the core caches until restart, even if the call would\n * later run). Any other JSON-RPC error is the node's, so it is rethrown retryable: a\n * provider fault never pins a token. Everything else propagates unchanged: a\n * misconfigured endpoint stays final, and a retryable failure is already retryable.\n */\n const tokenCall = async (contract: string, data: string): Promise<string> => {\n try {\n return await client.call({ to: contract, data }, 'latest', METADATA);\n } catch (error) {\n if (isRevert(error)) throw assetError('the token contract reverted');\n if (isExecutionFailure(error)) throw assetError('the token contract failed to run');\n if (isCryptoAioError(error, 'RPC_ERROR')) {\n throw withContext(error, {}, { retryable: true });\n }\n throw error;\n }\n };\n\n return {\n getBalance: async (address, asset) => {\n if (asset === 'native') return client.getBalance(address, 'latest', READ);\n return erc20Balance(client, tokenOf(asset), address, READ);\n },\n getBlockHeight: () => client.blockNumber(MONITOR),\n getFinalizedHeight: () => finalizedHeight(ctx, MONITOR),\n getBlock: async (ref) => {\n const block = await client.getBlock(ref, READ);\n return block ? toDriverBlock(block) : null;\n },\n getTransaction: async (id) => {\n const tx = await client.getTransaction(id, READ);\n if (!tx) return null;\n const receipt = tx.blockHash !== null ? await client.getReceipt(id, READ) : null;\n return decodeTransaction(client.abi, tx, receipt, undefined, ctx.config);\n },\n /**\n * With an ordering, the token verdict on one of our own Attempts. Without one (a\n * status lookup by id, for a transaction the library does not manage) the chain's\n * view, so a third party's call that shares the `transfer` selector is not reported\n * failed.\n */\n observe: async (ref, ordering) => {\n const tx = await client.getTransaction(ref.id, MONITOR);\n if (!tx) return { seen: 'none' };\n const receipt =\n tx.blockHash === null ? null : await client.getReceipt(ref.id, MONITOR);\n return ordering === undefined\n ? chainObservation(tx, receipt)\n : evmObservation(client.abi, tx, receipt);\n },\n getTokenMetadata: async (ref: TokenRef): Promise<AssetMetadata> => {\n const contract = tokenOf(ref);\n const decimalsData = await tokenCall(contract, client.abi.encodeDecimals());\n if (decimalsData === '0x') throw assetError('no token contract at this address');\n let decimals: bigint;\n try {\n decimals = client.abi.decodeUint256(decimalsData);\n } catch {\n throw assetError('the token decimals are unreadable');\n }\n if (decimals > 255n) throw assetError('the token decimals are out of range');\n const symbol = symbolText(\n client,\n await tokenCall(contract, client.abi.encodeSymbol()),\n );\n if (!symbol) throw assetError('the token has no symbol');\n return { symbol, decimals: Number(decimals) };\n },\n normalizeTokenRef: (ref) => {\n const contract = tokenOf(ref);\n if (!client.isAddress(contract)) throw assetError('not an EVM contract address');\n return { standard: 'erc20', contract: client.checksum(contract) };\n },\n };\n}\n\nexport function createEvmSequence(client: EvmClient): SequenceSource {\n return {\n pending: (address) => client.getTransactionCount(address, 'pending', MONITOR),\n latest: (address) => client.getTransactionCount(address, 'latest', MONITOR),\n };\n}\n\nexport function createEvmExt(client: EvmClient): EvmExt {\n return {\n evm: {\n getNonce: async (address, block = 'latest') => {\n if (block !== 'latest' && block !== 'pending') {\n throw new ValidationError(\n 'INVALID_INTENT',\n `block must be 'latest' or 'pending'`,\n );\n }\n const codec = createEvmAddressCodec(client);\n return client.getTransactionCount(\n codec.normalize(address).canonical,\n block,\n READ,\n );\n },\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The clients' common path to the core transport. `EthersClient` (directly) and
|
|
3
|
+
* `Web3Client` (through its EIP-1193 `request` object) end here, so each JSON-RPC
|
|
4
|
+
* call carries the purpose, retry class, quorum, fanout and signal of the driver method that
|
|
5
|
+
* made it.
|
|
6
|
+
*/
|
|
7
|
+
import type { Transport } from '../../core/transport/types';
|
|
8
|
+
import type { EvmCallTags } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* The consensus facts of a block read with its transactions to find the one that
|
|
11
|
+
* consumed a nonce: the block's number and hash, and each transaction's hash, sender and
|
|
12
|
+
* nonce, with the recipient and calldata that the token verdict reads.
|
|
13
|
+
*/
|
|
14
|
+
export declare function blockTransactionsKey(result: unknown): unknown;
|
|
15
|
+
/**
|
|
16
|
+
* The tags of a `crypto-aio/native` client's request: plain reads, except a broadcast, which
|
|
17
|
+
* is one: a failure after the transport may have delivered it is `ambiguous`, never an
|
|
18
|
+
* invitation to sign again with a new nonce.
|
|
19
|
+
*/
|
|
20
|
+
export declare const nativeTags: (method: string) => EvmCallTags;
|
|
21
|
+
/**
|
|
22
|
+
* The consensus facts compared under a quorum, per JSON-RPC method. Node implementations
|
|
23
|
+
* return extra or differently formatted fields (`size`, `totalDifficulty`, L2 extras), so a
|
|
24
|
+
* quorum over whole objects would report disagreement where there is none.
|
|
25
|
+
*/
|
|
26
|
+
export declare function quorumKeyFor(method: string): ((result: unknown) => unknown) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* One JSON-RPC call through the transport, under the calling driver method's tags. A quorum
|
|
29
|
+
* compares the caller's own `quorumKey` when it gives one, else the method's consensus
|
|
30
|
+
* facts; a key never travels without a quorum.
|
|
31
|
+
*/
|
|
32
|
+
export declare function transportCall(transport: Transport, method: string, params: unknown, tags: EvmCallTags): Promise<unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Runs `request` (an SDK call whose bridge ends in `call`) and, when its last transport call
|
|
35
|
+
* failed, rethrows the transport's own error, never an SDK wrapper of it: web3 turns an
|
|
36
|
+
* "execution reverted" error into a `ContractExecutionError`, which would lose the error's
|
|
37
|
+
* code and ambiguity. A failure followed by a successful call is forgotten.
|
|
38
|
+
*/
|
|
39
|
+
export declare function throughSdk<T>(request: (call: (method: string, params: unknown) => Promise<unknown>) => Promise<T>, transport: Transport, tags: EvmCallTags): Promise<T>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nativeTags = void 0;
|
|
4
|
+
exports.blockTransactionsKey = blockTransactionsKey;
|
|
5
|
+
exports.quorumKeyFor = quorumKeyFor;
|
|
6
|
+
exports.transportCall = transportCall;
|
|
7
|
+
exports.throughSdk = throughSdk;
|
|
8
|
+
const pick = (value, keys) => {
|
|
9
|
+
if (value === null || typeof value !== 'object')
|
|
10
|
+
return value;
|
|
11
|
+
const record = value;
|
|
12
|
+
return Object.fromEntries(keys.map((key) => [key, record[key] ?? null]));
|
|
13
|
+
};
|
|
14
|
+
const BLOCK = ['number', 'hash', 'parentHash', 'timestamp'];
|
|
15
|
+
const RECEIPT = ['transactionHash', 'blockHash', 'blockNumber', 'status'];
|
|
16
|
+
const TX = ['hash', 'blockHash', 'blockNumber', 'from', 'to', 'nonce'];
|
|
17
|
+
const LOG = ['address', 'topics', 'data', 'logIndex'];
|
|
18
|
+
const lowerCased = (value) => typeof value === 'string'
|
|
19
|
+
? value.toLowerCase()
|
|
20
|
+
: Array.isArray(value)
|
|
21
|
+
? value.map(lowerCased)
|
|
22
|
+
: value;
|
|
23
|
+
/** The `keys` of `value`, each lower-cased: hex case is formatting, not consensus. */
|
|
24
|
+
function lowerCasedFacts(value, keys) {
|
|
25
|
+
const facts = pick(value, keys);
|
|
26
|
+
return facts !== null && typeof facts === 'object'
|
|
27
|
+
? Object.fromEntries(Object.entries(facts).map(([key, fact]) => [key, lowerCased(fact)]))
|
|
28
|
+
: facts;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A transaction's calldata as the client reads it: `input`, or `data` on older nodes,
|
|
32
|
+
* lower-cased. The token verdict decodes it, so a key must compare it under
|
|
33
|
+
* either name, or a first endpoint answering with `data` could alter it unseen.
|
|
34
|
+
*/
|
|
35
|
+
function calldataOf(tx) {
|
|
36
|
+
if (tx === null || typeof tx !== 'object')
|
|
37
|
+
return null;
|
|
38
|
+
const { input, data } = tx;
|
|
39
|
+
return lowerCased(input ?? data ?? null);
|
|
40
|
+
}
|
|
41
|
+
/** A transaction's `keys`, lower-cased when `lower`, and its calldata as `input`. */
|
|
42
|
+
function txFacts(tx, keys, lower) {
|
|
43
|
+
if (tx === null || typeof tx !== 'object')
|
|
44
|
+
return tx;
|
|
45
|
+
const facts = (lower ? lowerCasedFacts(tx, keys) : pick(tx, keys));
|
|
46
|
+
return { ...facts, input: calldataOf(tx) };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A receipt's consensus facts include its logs, since a proven token verdict reads them:
|
|
50
|
+
* one endpoint that drops or alters a `Transfer` log must disagree. Hex case is
|
|
51
|
+
* formatting, not consensus, so each log's facts are compared lower-cased. A provider
|
|
52
|
+
* that formats logs another way fails proofs, but only retryably.
|
|
53
|
+
*/
|
|
54
|
+
function receiptKey(result) {
|
|
55
|
+
if (result === null || typeof result !== 'object')
|
|
56
|
+
return result;
|
|
57
|
+
const logs = result.logs;
|
|
58
|
+
return {
|
|
59
|
+
...pick(result, RECEIPT),
|
|
60
|
+
logs: Array.isArray(logs) ? logs.map((log) => lowerCasedFacts(log, LOG)) : null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const BLOCK_TX = ['hash', 'from', 'nonce', 'to'];
|
|
64
|
+
/**
|
|
65
|
+
* The consensus facts of a block read with its transactions to find the one that
|
|
66
|
+
* consumed a nonce: the block's number and hash, and each transaction's hash, sender and
|
|
67
|
+
* nonce, with the recipient and calldata that the token verdict reads.
|
|
68
|
+
*/
|
|
69
|
+
function blockTransactionsKey(result) {
|
|
70
|
+
if (result === null || typeof result !== 'object')
|
|
71
|
+
return result;
|
|
72
|
+
const txs = result.transactions;
|
|
73
|
+
return {
|
|
74
|
+
...lowerCasedFacts(result, ['number', 'hash']),
|
|
75
|
+
transactions: Array.isArray(txs)
|
|
76
|
+
? txs.map((tx) => txFacts(tx, BLOCK_TX, true))
|
|
77
|
+
: null,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const NATIVE_READ = { purpose: 'read', retry: 'safe' };
|
|
81
|
+
const NATIVE_BROADCAST = {
|
|
82
|
+
purpose: 'broadcast',
|
|
83
|
+
retry: 'ambiguous-on-failure',
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The tags of a `crypto-aio/native` client's request: plain reads, except a broadcast, which
|
|
87
|
+
* is one: a failure after the transport may have delivered it is `ambiguous`, never an
|
|
88
|
+
* invitation to sign again with a new nonce.
|
|
89
|
+
*/
|
|
90
|
+
const nativeTags = (method) => method === 'eth_sendRawTransaction' ? NATIVE_BROADCAST : NATIVE_READ;
|
|
91
|
+
exports.nativeTags = nativeTags;
|
|
92
|
+
/**
|
|
93
|
+
* The consensus facts compared under a quorum, per JSON-RPC method. Node implementations
|
|
94
|
+
* return extra or differently formatted fields (`size`, `totalDifficulty`, L2 extras), so a
|
|
95
|
+
* quorum over whole objects would report disagreement where there is none.
|
|
96
|
+
*/
|
|
97
|
+
function quorumKeyFor(method) {
|
|
98
|
+
switch (method) {
|
|
99
|
+
case 'eth_getBlockByNumber':
|
|
100
|
+
case 'eth_getBlockByHash':
|
|
101
|
+
return (result) => pick(result, BLOCK);
|
|
102
|
+
case 'eth_getTransactionReceipt':
|
|
103
|
+
return receiptKey;
|
|
104
|
+
case 'eth_getBlockReceipts':
|
|
105
|
+
return (result) => (Array.isArray(result) ? result.map(receiptKey) : result);
|
|
106
|
+
case 'eth_getTransactionByHash':
|
|
107
|
+
return (result) => txFacts(result, TX, false);
|
|
108
|
+
default:
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* One JSON-RPC call through the transport, under the calling driver method's tags. A quorum
|
|
114
|
+
* compares the caller's own `quorumKey` when it gives one, else the method's consensus
|
|
115
|
+
* facts; a key never travels without a quorum.
|
|
116
|
+
*/
|
|
117
|
+
function transportCall(transport, method, params, tags) {
|
|
118
|
+
const { quorumKey: own, ...rest } = tags;
|
|
119
|
+
const quorumKey = rest.quorum !== undefined ? (own ?? quorumKeyFor(method)) : undefined;
|
|
120
|
+
return transport.rpc(method, params ?? [], {
|
|
121
|
+
...rest,
|
|
122
|
+
...(quorumKey ? { quorumKey } : {}),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Runs `request` (an SDK call whose bridge ends in `call`) and, when its last transport call
|
|
127
|
+
* failed, rethrows the transport's own error, never an SDK wrapper of it: web3 turns an
|
|
128
|
+
* "execution reverted" error into a `ContractExecutionError`, which would lose the error's
|
|
129
|
+
* code and ambiguity. A failure followed by a successful call is forgotten.
|
|
130
|
+
*/
|
|
131
|
+
async function throughSdk(request, transport, tags) {
|
|
132
|
+
let failure;
|
|
133
|
+
const call = async (method, params) => {
|
|
134
|
+
try {
|
|
135
|
+
const result = await transportCall(transport, method, params, tags);
|
|
136
|
+
// Only a failure the SDK did not recover from may replace the SDK's own error.
|
|
137
|
+
failure = undefined;
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
failure = { error };
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
return await request(call);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
throw failure ? failure.error : error;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# source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gD,CAAC;IACrD,MAAM,IAAI,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAoB,EAAE;QACvE,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YACpE,+EAA+E;YAC/E,OAAO,GAAG,SAAS,CAAC;YACpB,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,EAAE,KAAK,EAAE,CAAC;YACpB,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IACF,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IACxC,CAAC;AACH,CAAC","sourcesContent":["/**\n * The clients' common path to the core transport. `EthersClient` (directly) and\n * `Web3Client` (through its EIP-1193 `request` object) end here, so each JSON-RPC\n * call carries the purpose, retry class, quorum, fanout and signal of the driver method that\n * made it.\n */\nimport type { Transport } from '../../core/transport/types';\nimport type { EvmCallTags } from './types';\n\ntype Json = Record<string, unknown> | null;\n\nconst pick = (value: unknown, keys: readonly string[]): unknown => {\n if (value === null || typeof value !== 'object') return value;\n const record = value as Record<string, unknown>;\n return Object.fromEntries(keys.map((key) => [key, record[key] ?? null]));\n};\n\nconst BLOCK = ['number', 'hash', 'parentHash', 'timestamp'] as const;\nconst RECEIPT = ['transactionHash', 'blockHash', 'blockNumber', 'status'] as const;\nconst TX = ['hash', 'blockHash', 'blockNumber', 'from', 'to', 'nonce'] as const;\nconst LOG = ['address', 'topics', 'data', 'logIndex'] as const;\n\nconst lowerCased = (value: unknown): unknown =>\n typeof value === 'string'\n ? value.toLowerCase()\n : Array.isArray(value)\n ? value.map(lowerCased)\n : value;\n\n/** The `keys` of `value`, each lower-cased: hex case is formatting, not consensus. */\nfunction lowerCasedFacts(value: unknown, keys: readonly string[]): unknown {\n const facts = pick(value, keys);\n return facts !== null && typeof facts === 'object'\n ? Object.fromEntries(\n Object.entries(facts).map(([key, fact]) => [key, lowerCased(fact)]),\n )\n : facts;\n}\n\n/**\n * A transaction's calldata as the client reads it: `input`, or `data` on older nodes,\n * lower-cased. The token verdict decodes it, so a key must compare it under\n * either name, or a first endpoint answering with `data` could alter it unseen.\n */\nfunction calldataOf(tx: unknown): unknown {\n if (tx === null || typeof tx !== 'object') return null;\n const { input, data } = tx as Record<string, unknown>;\n return lowerCased(input ?? data ?? null);\n}\n\n/** A transaction's `keys`, lower-cased when `lower`, and its calldata as `input`. */\nfunction txFacts(tx: unknown, keys: readonly string[], lower: boolean): unknown {\n if (tx === null || typeof tx !== 'object') return tx;\n const facts = (lower ? lowerCasedFacts(tx, keys) : pick(tx, keys)) as Record<\n string,\n unknown\n >;\n return { ...facts, input: calldataOf(tx) };\n}\n\n/**\n * A receipt's consensus facts include its logs, since a proven token verdict reads them:\n * one endpoint that drops or alters a `Transfer` log must disagree. Hex case is\n * formatting, not consensus, so each log's facts are compared lower-cased. A provider\n * that formats logs another way fails proofs, but only retryably.\n */\nfunction receiptKey(result: unknown): unknown {\n if (result === null || typeof result !== 'object') return result;\n const logs = (result as Record<string, unknown>).logs;\n return {\n ...(pick(result, RECEIPT) as Record<string, unknown>),\n logs: Array.isArray(logs) ? logs.map((log) => lowerCasedFacts(log, LOG)) : null,\n };\n}\n\nconst BLOCK_TX = ['hash', 'from', 'nonce', 'to'] as const;\n\n/**\n * The consensus facts of a block read with its transactions to find the one that\n * consumed a nonce: the block's number and hash, and each transaction's hash, sender and\n * nonce, with the recipient and calldata that the token verdict reads.\n */\nexport function blockTransactionsKey(result: unknown): unknown {\n if (result === null || typeof result !== 'object') return result;\n const txs = (result as Record<string, unknown>).transactions;\n return {\n ...(lowerCasedFacts(result, ['number', 'hash']) as Record<string, unknown>),\n transactions: Array.isArray(txs)\n ? txs.map((tx) => txFacts(tx, BLOCK_TX, true))\n : null,\n };\n}\n\nconst NATIVE_READ: EvmCallTags = { purpose: 'read', retry: 'safe' };\nconst NATIVE_BROADCAST: EvmCallTags = {\n purpose: 'broadcast',\n retry: 'ambiguous-on-failure',\n};\n\n/**\n * The tags of a `crypto-aio/native` client's request: plain reads, except a broadcast, which\n * is one: a failure after the transport may have delivered it is `ambiguous`, never an\n * invitation to sign again with a new nonce.\n */\nexport const nativeTags = (method: string): EvmCallTags =>\n method === 'eth_sendRawTransaction' ? NATIVE_BROADCAST : NATIVE_READ;\n\n/**\n * The consensus facts compared under a quorum, per JSON-RPC method. Node implementations\n * return extra or differently formatted fields (`size`, `totalDifficulty`, L2 extras), so a\n * quorum over whole objects would report disagreement where there is none.\n */\nexport function quorumKeyFor(method: string): ((result: unknown) => unknown) | undefined {\n switch (method) {\n case 'eth_getBlockByNumber':\n case 'eth_getBlockByHash':\n return (result) => pick(result as Json, BLOCK);\n case 'eth_getTransactionReceipt':\n return receiptKey;\n case 'eth_getBlockReceipts':\n return (result) => (Array.isArray(result) ? result.map(receiptKey) : result);\n case 'eth_getTransactionByHash':\n return (result) => txFacts(result, TX, false);\n default:\n return undefined;\n }\n}\n\n/**\n * One JSON-RPC call through the transport, under the calling driver method's tags. A quorum\n * compares the caller's own `quorumKey` when it gives one, else the method's consensus\n * facts; a key never travels without a quorum.\n */\nexport function transportCall(\n transport: Transport,\n method: string,\n params: unknown,\n tags: EvmCallTags,\n): Promise<unknown> {\n const { quorumKey: own, ...rest } = tags;\n const quorumKey = rest.quorum !== undefined ? (own ?? quorumKeyFor(method)) : undefined;\n return transport.rpc(method, params ?? [], {\n ...rest,\n ...(quorumKey ? { quorumKey } : {}),\n });\n}\n\n/**\n * Runs `request` (an SDK call whose bridge ends in `call`) and, when its last transport call\n * failed, rethrows the transport's own error, never an SDK wrapper of it: web3 turns an\n * \"execution reverted\" error into a `ContractExecutionError`, which would lose the error's\n * code and ambiguity. A failure followed by a successful call is forgotten.\n */\nexport async function throughSdk<T>(\n request: (call: (method: string, params: unknown) => Promise<unknown>) => Promise<T>,\n transport: Transport,\n tags: EvmCallTags,\n): Promise<T> {\n let failure: { readonly error: unknown } | undefined;\n const call = async (method: string, params: unknown): Promise<unknown> => {\n try {\n const result = await transportCall(transport, method, params, tags);\n // Only a failure the SDK did not recover from may replace the SDK's own error.\n failure = undefined;\n return result;\n } catch (error) {\n failure = { error };\n throw error;\n }\n };\n try {\n return await request(call);\n } catch (error) {\n throw failure ? failure.error : error;\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known tokens: USDT and USDC where their issuers deploy them natively on
|
|
3
|
+
* a built-in mainnet (Tether's supported-protocols page, Circle's USDC addresses page).
|
|
4
|
+
* Addresses are EIP-55 checksummed; decimals are verified on each chain's explorer.
|
|
5
|
+
*/
|
|
6
|
+
import type { AssetRegistration } from '../../core/registry/assets';
|
|
7
|
+
export declare const EVM_TOKENS: readonly AssetRegistration[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EVM_TOKENS = void 0;
|
|
4
|
+
function token(chain, symbol, contract) {
|
|
5
|
+
return {
|
|
6
|
+
chain,
|
|
7
|
+
network: 'mainnet',
|
|
8
|
+
ref: { standard: 'erc20', contract },
|
|
9
|
+
metadata: { symbol, decimals: 6 },
|
|
10
|
+
aliases: [symbol],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.EVM_TOKENS = [
|
|
14
|
+
token('ethereum', 'USDT', '0xdAC17F958D2ee523a2206206994597C13D831ec7'),
|
|
15
|
+
token('ethereum', 'USDC', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
|
|
16
|
+
token('avalanche', 'USDT', '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7'),
|
|
17
|
+
token('avalanche', 'USDC', '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E'),
|
|
18
|
+
token('polygon', 'USDC', '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'),
|
|
19
|
+
token('arbitrum', 'USDC', '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'),
|
|
20
|
+
token('optimism', 'USDC', '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85'),
|
|
21
|
+
token('base', 'USDC', '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'),
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/adapters/evm/tokens.ts"],"names":[],"mappings":";;;AAOA,SAAS,KAAK,CACZ,KAAa,EACb,MAAuB,EACvB,QAAgB;IAEhB,OAAO;QACL,KAAK;QACL,OAAO,EAAE,SAAS;QAClB,GAAG,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE;QACpC,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE;QACjC,OAAO,EAAE,CAAC,MAAM,CAAC;KAClB,CAAC;AACJ,CAAC;AAEY,QAAA,UAAU,GAAiC;IACtD,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACvE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACvE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACxE,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACxE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACtE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACvE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,4CAA4C,CAAC;IACvE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,4CAA4C,CAAC;CACpE,CAAC","sourcesContent":["/**\n * Well-known tokens: USDT and USDC where their issuers deploy them natively on\n * a built-in mainnet (Tether's supported-protocols page, Circle's USDC addresses page).\n * Addresses are EIP-55 checksummed; decimals are verified on each chain's explorer.\n */\nimport type { AssetRegistration } from '../../core/registry/assets';\n\nfunction token(\n chain: string,\n symbol: 'USDT' | 'USDC',\n contract: string,\n): AssetRegistration {\n return {\n chain,\n network: 'mainnet',\n ref: { standard: 'erc20', contract },\n metadata: { symbol, decimals: 6 },\n aliases: [symbol],\n };\n}\n\nexport const EVM_TOKENS: readonly AssetRegistration[] = [\n token('ethereum', 'USDT', '0xdAC17F958D2ee523a2206206994597C13D831ec7'),\n token('ethereum', 'USDC', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),\n token('avalanche', 'USDT', '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7'),\n token('avalanche', 'USDC', '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E'),\n token('polygon', 'USDC', '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'),\n token('arbitrum', 'USDC', '0xaf88d065e77c8cC2239327C5EDb3A432268e5831'),\n token('optimism', 'USDC', '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85'),\n token('base', 'USDC', '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'),\n];\n"]}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK-free types of the EVM family: the `ext.evm` API, fee details and overrides, and the
|
|
3
|
+
* narrow `EvmClient` strategy that `EthersClient` and `Web3Client` implement.
|
|
4
|
+
* Nothing here imports an SDK, so the composition root can export these types.
|
|
5
|
+
*/
|
|
6
|
+
import type { DisposableNativeClient } from '../../core/driver/types';
|
|
7
|
+
import type { CallOptions } from '../../core/transport/types';
|
|
8
|
+
declare module '../../index' {
|
|
9
|
+
interface ChainRegistry {
|
|
10
|
+
ethereum: {
|
|
11
|
+
family: 'evm';
|
|
12
|
+
network: 'mainnet' | 'sepolia' | 'hoodi';
|
|
13
|
+
};
|
|
14
|
+
bsc: {
|
|
15
|
+
family: 'evm';
|
|
16
|
+
network: 'mainnet' | 'testnet';
|
|
17
|
+
};
|
|
18
|
+
polygon: {
|
|
19
|
+
family: 'evm';
|
|
20
|
+
network: 'mainnet' | 'amoy';
|
|
21
|
+
};
|
|
22
|
+
avalanche: {
|
|
23
|
+
family: 'evm';
|
|
24
|
+
network: 'mainnet' | 'fuji';
|
|
25
|
+
};
|
|
26
|
+
arbitrum: {
|
|
27
|
+
family: 'evm';
|
|
28
|
+
network: 'mainnet' | 'sepolia';
|
|
29
|
+
};
|
|
30
|
+
optimism: {
|
|
31
|
+
family: 'evm';
|
|
32
|
+
network: 'mainnet' | 'sepolia';
|
|
33
|
+
};
|
|
34
|
+
base: {
|
|
35
|
+
family: 'evm';
|
|
36
|
+
network: 'mainnet' | 'sepolia';
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface FamilyRegistry {
|
|
40
|
+
evm: {
|
|
41
|
+
library: 'ethers' | 'web3';
|
|
42
|
+
ext: EvmExt;
|
|
43
|
+
fee: EvmFeeDetails;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** `bc.ext.evm`: the EVM family extension. */
|
|
48
|
+
export interface EvmExt {
|
|
49
|
+
readonly evm: {
|
|
50
|
+
/** The account nonce at `latest` (default) or including the mempool (`pending`). */
|
|
51
|
+
getNonce(address: string, block?: 'latest' | 'pending'): Promise<bigint>;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** `FeeEstimate.details` of the `evm-1559` and `evm-legacy` fee kinds (wei, gas units). */
|
|
55
|
+
export interface EvmFeeDetails {
|
|
56
|
+
readonly gasLimit: bigint;
|
|
57
|
+
/** `evm-1559` only. */
|
|
58
|
+
readonly maxFeePerGas?: bigint;
|
|
59
|
+
/** `evm-1559` only. */
|
|
60
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
61
|
+
/** `evm-1559` only: the base fee the estimate expects for the next block. */
|
|
62
|
+
readonly baseFeePerGas?: bigint;
|
|
63
|
+
/** `evm-legacy` only. */
|
|
64
|
+
readonly gasPrice?: bigint;
|
|
65
|
+
/** OP Stack networks: the L1 data fee estimate, also charged as `l1-data`. */
|
|
66
|
+
readonly l1Fee?: bigint;
|
|
67
|
+
/** The expected total cost in wei; the `network` charge is its upper bound. */
|
|
68
|
+
readonly expected: bigint;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* An explicit EVM fee (`TransferIntent.fee`). It must match the network's fee model:
|
|
72
|
+
* `evm-1559` networks take `{ maxFeePerGas, maxPriorityFeePerGas }`, `evm-legacy` networks
|
|
73
|
+
* take `{ gasPrice }`. `gasLimit` replaces the node's gas estimate.
|
|
74
|
+
*/
|
|
75
|
+
export type EvmFeeOverride = {
|
|
76
|
+
readonly maxFeePerGas: bigint;
|
|
77
|
+
readonly maxPriorityFeePerGas: bigint;
|
|
78
|
+
readonly gasLimit?: bigint;
|
|
79
|
+
} | {
|
|
80
|
+
readonly gasPrice: bigint;
|
|
81
|
+
readonly gasLimit?: bigint;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The transport tags every EVM I/O call carries: purpose, retry, quorum, fanout,
|
|
85
|
+
* signal. Under a quorum, `quorumKey` replaces the method's consensus facts (`rpc.ts`) with
|
|
86
|
+
* the caller's own projection, e.g. a proof's finality attestation.
|
|
87
|
+
*/
|
|
88
|
+
export type EvmCallTags = Pick<CallOptions, 'purpose' | 'retry' | 'quorum' | 'quorumKey' | 'fanout' | 'signal'>;
|
|
89
|
+
/** A block number or a JSON-RPC block tag. */
|
|
90
|
+
export type EvmBlockTag = bigint | 'latest' | 'pending' | 'safe' | 'finalized';
|
|
91
|
+
export interface EvmBlock {
|
|
92
|
+
readonly number: bigint;
|
|
93
|
+
readonly hash: string;
|
|
94
|
+
readonly parentHash: string;
|
|
95
|
+
readonly timestamp: number;
|
|
96
|
+
readonly baseFeePerGas?: bigint;
|
|
97
|
+
readonly transactions: readonly string[];
|
|
98
|
+
}
|
|
99
|
+
export interface EvmTx {
|
|
100
|
+
readonly hash: string;
|
|
101
|
+
readonly from: string;
|
|
102
|
+
readonly to: string | null;
|
|
103
|
+
readonly nonce: bigint;
|
|
104
|
+
readonly value: bigint;
|
|
105
|
+
readonly input: string;
|
|
106
|
+
readonly type: number;
|
|
107
|
+
readonly gasLimit: bigint;
|
|
108
|
+
readonly gasPrice?: bigint;
|
|
109
|
+
readonly maxFeePerGas?: bigint;
|
|
110
|
+
readonly maxPriorityFeePerGas?: bigint;
|
|
111
|
+
readonly blockHash: string | null;
|
|
112
|
+
readonly blockNumber: bigint | null;
|
|
113
|
+
}
|
|
114
|
+
export interface EvmFullBlock extends Omit<EvmBlock, 'transactions'> {
|
|
115
|
+
readonly transactions: readonly EvmTx[];
|
|
116
|
+
/** The block's 256-byte log bloom, when the node serves a well-formed one. */
|
|
117
|
+
readonly logsBloom?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface EvmLog {
|
|
120
|
+
readonly address: string;
|
|
121
|
+
readonly topics: readonly string[];
|
|
122
|
+
readonly data: string;
|
|
123
|
+
readonly logIndex: number;
|
|
124
|
+
readonly blockHash: string;
|
|
125
|
+
readonly blockNumber: bigint;
|
|
126
|
+
readonly transactionHash: string;
|
|
127
|
+
readonly removed: boolean;
|
|
128
|
+
}
|
|
129
|
+
export interface EvmReceipt {
|
|
130
|
+
readonly transactionHash: string;
|
|
131
|
+
readonly blockHash: string;
|
|
132
|
+
readonly blockNumber: bigint;
|
|
133
|
+
readonly status: 0 | 1;
|
|
134
|
+
readonly from: string;
|
|
135
|
+
readonly to: string | null;
|
|
136
|
+
readonly contractAddress: string | null;
|
|
137
|
+
readonly gasUsed: bigint;
|
|
138
|
+
readonly effectiveGasPrice: bigint;
|
|
139
|
+
/** OP Stack receipts: the L1 data fee paid. */
|
|
140
|
+
readonly l1Fee?: bigint;
|
|
141
|
+
/** Arbitrum receipts: the part of `gasUsed` that paid for L1 data. */
|
|
142
|
+
readonly gasUsedForL1?: bigint;
|
|
143
|
+
readonly logs: readonly EvmLog[];
|
|
144
|
+
}
|
|
145
|
+
export interface EvmFeeHistory {
|
|
146
|
+
readonly oldestBlock: bigint;
|
|
147
|
+
/** One entry per block, plus the next block's base fee last. */
|
|
148
|
+
readonly baseFeePerGas: readonly bigint[];
|
|
149
|
+
/** Per block, the requested percentiles of the priority fees paid. */
|
|
150
|
+
readonly reward: readonly (readonly bigint[])[];
|
|
151
|
+
readonly gasUsedRatio: readonly number[];
|
|
152
|
+
}
|
|
153
|
+
export interface EvmCallRequest {
|
|
154
|
+
readonly from?: string;
|
|
155
|
+
readonly to: string;
|
|
156
|
+
readonly value?: bigint;
|
|
157
|
+
readonly data?: string;
|
|
158
|
+
}
|
|
159
|
+
interface EvmTxFieldsBase {
|
|
160
|
+
readonly chainId: bigint;
|
|
161
|
+
readonly nonce: bigint;
|
|
162
|
+
readonly to: string;
|
|
163
|
+
readonly value: bigint;
|
|
164
|
+
readonly data: string;
|
|
165
|
+
readonly gasLimit: bigint;
|
|
166
|
+
}
|
|
167
|
+
/** The fields of an unsigned transaction: EIP-1559 (type 2) or legacy with EIP-155. */
|
|
168
|
+
export type EvmTxFields = EvmTxFieldsBase & ({
|
|
169
|
+
readonly type: 'eip1559';
|
|
170
|
+
readonly maxFeePerGas: bigint;
|
|
171
|
+
readonly maxPriorityFeePerGas: bigint;
|
|
172
|
+
} | {
|
|
173
|
+
readonly type: 'legacy';
|
|
174
|
+
readonly gasPrice: bigint;
|
|
175
|
+
});
|
|
176
|
+
/** A secp256k1 signature: 32-byte `r` and `s` as 0x-hex, and the y parity (0 or 1). */
|
|
177
|
+
export interface EvmSignature {
|
|
178
|
+
readonly r: string;
|
|
179
|
+
readonly s: string;
|
|
180
|
+
readonly yParity: 0 | 1;
|
|
181
|
+
}
|
|
182
|
+
/** ABI work for the ERC-20 calls and events the driver uses, done by the SDK. */
|
|
183
|
+
export interface EvmAbi {
|
|
184
|
+
/** `keccak256("Transfer(address,address,uint256)")`. */
|
|
185
|
+
readonly transferTopic: string;
|
|
186
|
+
encodeTransfer(to: string, amount: bigint): string;
|
|
187
|
+
encodeBalanceOf(owner: string): string;
|
|
188
|
+
encodeDecimals(): string;
|
|
189
|
+
encodeSymbol(): string;
|
|
190
|
+
/** OP Stack `GasPriceOracle.getL1Fee(bytes)` over an unsigned serialized transaction. */
|
|
191
|
+
encodeGetL1Fee(unsignedTx: string): string;
|
|
192
|
+
/** Throws on data that is not one ABI `uint256` word. */
|
|
193
|
+
decodeUint256(data: string): bigint;
|
|
194
|
+
/** Throws on data that is not an ABI `string`. */
|
|
195
|
+
decodeString(data: string): string;
|
|
196
|
+
/** An ERC-20 `Transfer` log's parties and amount; `null` for any other log. */
|
|
197
|
+
decodeTransfer(log: {
|
|
198
|
+
readonly topics: readonly string[];
|
|
199
|
+
readonly data: string;
|
|
200
|
+
}): {
|
|
201
|
+
readonly from: string;
|
|
202
|
+
readonly to: string;
|
|
203
|
+
readonly amount: bigint;
|
|
204
|
+
} | null;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The EVM strategy: the SDK-specific part of the EVM driver. I/O methods take the call's
|
|
208
|
+
* transport tags and return plain data (bigint, hex strings, plain objects), never SDK
|
|
209
|
+
* objects, so any result can go into a store record; `null` means not found. Codec
|
|
210
|
+
* methods are synchronous.
|
|
211
|
+
*/
|
|
212
|
+
export interface EvmClient {
|
|
213
|
+
readonly library: string;
|
|
214
|
+
blockNumber(tags: EvmCallTags): Promise<bigint>;
|
|
215
|
+
getBalance(address: string, block: EvmBlockTag, tags: EvmCallTags): Promise<bigint>;
|
|
216
|
+
getTransactionCount(address: string, block: EvmBlockTag, tags: EvmCallTags): Promise<bigint>;
|
|
217
|
+
call(request: EvmCallRequest, block: EvmBlockTag, tags: EvmCallTags): Promise<string>;
|
|
218
|
+
estimateGas(request: EvmCallRequest, tags: EvmCallTags): Promise<bigint>;
|
|
219
|
+
gasPrice(tags: EvmCallTags): Promise<bigint>;
|
|
220
|
+
feeHistory(blockCount: number, newest: EvmBlockTag, percentiles: readonly number[], tags: EvmCallTags): Promise<EvmFeeHistory>;
|
|
221
|
+
/** By number or tag, or by hash when `block` is a 0x-prefixed 32-byte hash. */
|
|
222
|
+
getBlock(block: EvmBlockTag | string, tags: EvmCallTags): Promise<EvmBlock | null>;
|
|
223
|
+
getBlockWithTransactions(block: bigint, tags: EvmCallTags): Promise<EvmFullBlock | null>;
|
|
224
|
+
getTransaction(hash: string, tags: EvmCallTags): Promise<EvmTx | null>;
|
|
225
|
+
getReceipt(hash: string, tags: EvmCallTags): Promise<EvmReceipt | null>;
|
|
226
|
+
/**
|
|
227
|
+
* Every receipt of the block with this hash, in block order (`eth_getBlockReceipts`):
|
|
228
|
+
* read by block, so a node serves them without a transaction or log index. `null` for a
|
|
229
|
+
* block the node does not know.
|
|
230
|
+
*/
|
|
231
|
+
getBlockReceipts(blockHash: string, tags: EvmCallTags): Promise<readonly EvmReceipt[] | null>;
|
|
232
|
+
getLogs(filter: {
|
|
233
|
+
readonly blockHash: string;
|
|
234
|
+
readonly topics: readonly (string | null)[];
|
|
235
|
+
}, tags: EvmCallTags): Promise<readonly EvmLog[]>;
|
|
236
|
+
/** Resolves with the transaction hash the node reports. */
|
|
237
|
+
sendRawTransaction(raw: string, tags: EvmCallTags): Promise<string>;
|
|
238
|
+
/** Strict: `0x` and 40 hex digits; mixed case must be a valid EIP-55 checksum. */
|
|
239
|
+
isAddress(value: string): boolean;
|
|
240
|
+
/** EIP-55 checksum form; throws on an invalid address. */
|
|
241
|
+
checksum(address: string): string;
|
|
242
|
+
/** From a 33-byte compressed or 65-byte uncompressed secp256k1 public key. */
|
|
243
|
+
addressFromPublicKey(publicKey: Uint8Array): string;
|
|
244
|
+
serializeUnsigned(tx: EvmTxFields): string;
|
|
245
|
+
/** The keccak-256 digest a signer signs. */
|
|
246
|
+
unsignedHash(tx: EvmTxFields): string;
|
|
247
|
+
serializeSigned(tx: EvmTxFields, signature: EvmSignature): {
|
|
248
|
+
readonly raw: string;
|
|
249
|
+
readonly hash: string;
|
|
250
|
+
};
|
|
251
|
+
readonly abi: EvmAbi;
|
|
252
|
+
/** A fresh SDK client on the same transport, for `crypto-aio/native`. */
|
|
253
|
+
createNative(): DisposableNativeClient;
|
|
254
|
+
}
|
|
255
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/evm/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * SDK-free types of the EVM family: the `ext.evm` API, fee details and overrides, and the\n * narrow `EvmClient` strategy that `EthersClient` and `Web3Client` implement.\n * Nothing here imports an SDK, so the composition root can export these types.\n */\nimport type { DisposableNativeClient } from '../../core/driver/types';\nimport type { CallOptions } from '../../core/transport/types';\n\n// Augment the registries through the package entry, as users do with 'crypto-aio'.\ndeclare module '../../index' {\n interface ChainRegistry {\n ethereum: { family: 'evm'; network: 'mainnet' | 'sepolia' | 'hoodi' };\n bsc: { family: 'evm'; network: 'mainnet' | 'testnet' };\n polygon: { family: 'evm'; network: 'mainnet' | 'amoy' };\n avalanche: { family: 'evm'; network: 'mainnet' | 'fuji' };\n arbitrum: { family: 'evm'; network: 'mainnet' | 'sepolia' };\n optimism: { family: 'evm'; network: 'mainnet' | 'sepolia' };\n base: { family: 'evm'; network: 'mainnet' | 'sepolia' };\n }\n interface FamilyRegistry {\n evm: { library: 'ethers' | 'web3'; ext: EvmExt; fee: EvmFeeDetails };\n }\n}\n\n/** `bc.ext.evm`: the EVM family extension. */\nexport interface EvmExt {\n readonly evm: {\n /** The account nonce at `latest` (default) or including the mempool (`pending`). */\n getNonce(address: string, block?: 'latest' | 'pending'): Promise<bigint>;\n };\n}\n\n/** `FeeEstimate.details` of the `evm-1559` and `evm-legacy` fee kinds (wei, gas units). */\nexport interface EvmFeeDetails {\n readonly gasLimit: bigint;\n /** `evm-1559` only. */\n readonly maxFeePerGas?: bigint;\n /** `evm-1559` only. */\n readonly maxPriorityFeePerGas?: bigint;\n /** `evm-1559` only: the base fee the estimate expects for the next block. */\n readonly baseFeePerGas?: bigint;\n /** `evm-legacy` only. */\n readonly gasPrice?: bigint;\n /** OP Stack networks: the L1 data fee estimate, also charged as `l1-data`. */\n readonly l1Fee?: bigint;\n /** The expected total cost in wei; the `network` charge is its upper bound. */\n readonly expected: bigint;\n}\n\n/**\n * An explicit EVM fee (`TransferIntent.fee`). It must match the network's fee model:\n * `evm-1559` networks take `{ maxFeePerGas, maxPriorityFeePerGas }`, `evm-legacy` networks\n * take `{ gasPrice }`. `gasLimit` replaces the node's gas estimate.\n */\nexport type EvmFeeOverride =\n | {\n readonly maxFeePerGas: bigint;\n readonly maxPriorityFeePerGas: bigint;\n readonly gasLimit?: bigint;\n }\n | { readonly gasPrice: bigint; readonly gasLimit?: bigint };\n\n/**\n * The transport tags every EVM I/O call carries: purpose, retry, quorum, fanout,\n * signal. Under a quorum, `quorumKey` replaces the method's consensus facts (`rpc.ts`) with\n * the caller's own projection, e.g. a proof's finality attestation.\n */\nexport type EvmCallTags = Pick<\n CallOptions,\n 'purpose' | 'retry' | 'quorum' | 'quorumKey' | 'fanout' | 'signal'\n>;\n\n/** A block number or a JSON-RPC block tag. */\nexport type EvmBlockTag = bigint | 'latest' | 'pending' | 'safe' | 'finalized';\n\nexport interface EvmBlock {\n readonly number: bigint;\n readonly hash: string;\n readonly parentHash: string;\n readonly timestamp: number;\n readonly baseFeePerGas?: bigint;\n readonly transactions: readonly string[];\n}\n\nexport interface EvmTx {\n readonly hash: string;\n readonly from: string;\n readonly to: string | null;\n readonly nonce: bigint;\n readonly value: bigint;\n readonly input: string;\n readonly type: number;\n readonly gasLimit: bigint;\n readonly gasPrice?: bigint;\n readonly maxFeePerGas?: bigint;\n readonly maxPriorityFeePerGas?: bigint;\n readonly blockHash: string | null;\n readonly blockNumber: bigint | null;\n}\n\nexport interface EvmFullBlock extends Omit<EvmBlock, 'transactions'> {\n readonly transactions: readonly EvmTx[];\n /** The block's 256-byte log bloom, when the node serves a well-formed one. */\n readonly logsBloom?: string;\n}\n\nexport interface EvmLog {\n readonly address: string;\n readonly topics: readonly string[];\n readonly data: string;\n readonly logIndex: number;\n readonly blockHash: string;\n readonly blockNumber: bigint;\n readonly transactionHash: string;\n readonly removed: boolean;\n}\n\nexport interface EvmReceipt {\n readonly transactionHash: string;\n readonly blockHash: string;\n readonly blockNumber: bigint;\n readonly status: 0 | 1;\n readonly from: string;\n readonly to: string | null;\n readonly contractAddress: string | null;\n readonly gasUsed: bigint;\n readonly effectiveGasPrice: bigint;\n /** OP Stack receipts: the L1 data fee paid. */\n readonly l1Fee?: bigint;\n /** Arbitrum receipts: the part of `gasUsed` that paid for L1 data. */\n readonly gasUsedForL1?: bigint;\n readonly logs: readonly EvmLog[];\n}\n\nexport interface EvmFeeHistory {\n readonly oldestBlock: bigint;\n /** One entry per block, plus the next block's base fee last. */\n readonly baseFeePerGas: readonly bigint[];\n /** Per block, the requested percentiles of the priority fees paid. */\n readonly reward: readonly (readonly bigint[])[];\n readonly gasUsedRatio: readonly number[];\n}\n\nexport interface EvmCallRequest {\n readonly from?: string;\n readonly to: string;\n readonly value?: bigint;\n readonly data?: string;\n}\n\ninterface EvmTxFieldsBase {\n readonly chainId: bigint;\n readonly nonce: bigint;\n readonly to: string;\n readonly value: bigint;\n readonly data: string;\n readonly gasLimit: bigint;\n}\n\n/** The fields of an unsigned transaction: EIP-1559 (type 2) or legacy with EIP-155. */\nexport type EvmTxFields = EvmTxFieldsBase &\n (\n | {\n readonly type: 'eip1559';\n readonly maxFeePerGas: bigint;\n readonly maxPriorityFeePerGas: bigint;\n }\n | { readonly type: 'legacy'; readonly gasPrice: bigint }\n );\n\n/** A secp256k1 signature: 32-byte `r` and `s` as 0x-hex, and the y parity (0 or 1). */\nexport interface EvmSignature {\n readonly r: string;\n readonly s: string;\n readonly yParity: 0 | 1;\n}\n\n/** ABI work for the ERC-20 calls and events the driver uses, done by the SDK. */\nexport interface EvmAbi {\n /** `keccak256(\"Transfer(address,address,uint256)\")`. */\n readonly transferTopic: string;\n encodeTransfer(to: string, amount: bigint): string;\n encodeBalanceOf(owner: string): string;\n encodeDecimals(): string;\n encodeSymbol(): string;\n /** OP Stack `GasPriceOracle.getL1Fee(bytes)` over an unsigned serialized transaction. */\n encodeGetL1Fee(unsignedTx: string): string;\n /** Throws on data that is not one ABI `uint256` word. */\n decodeUint256(data: string): bigint;\n /** Throws on data that is not an ABI `string`. */\n decodeString(data: string): string;\n /** An ERC-20 `Transfer` log's parties and amount; `null` for any other log. */\n decodeTransfer(log: {\n readonly topics: readonly string[];\n readonly data: string;\n }): { readonly from: string; readonly to: string; readonly amount: bigint } | null;\n}\n\n/**\n * The EVM strategy: the SDK-specific part of the EVM driver. I/O methods take the call's\n * transport tags and return plain data (bigint, hex strings, plain objects), never SDK\n * objects, so any result can go into a store record; `null` means not found. Codec\n * methods are synchronous.\n */\nexport interface EvmClient {\n readonly library: string;\n blockNumber(tags: EvmCallTags): Promise<bigint>;\n getBalance(address: string, block: EvmBlockTag, tags: EvmCallTags): Promise<bigint>;\n getTransactionCount(\n address: string,\n block: EvmBlockTag,\n tags: EvmCallTags,\n ): Promise<bigint>;\n call(request: EvmCallRequest, block: EvmBlockTag, tags: EvmCallTags): Promise<string>;\n estimateGas(request: EvmCallRequest, tags: EvmCallTags): Promise<bigint>;\n gasPrice(tags: EvmCallTags): Promise<bigint>;\n feeHistory(\n blockCount: number,\n newest: EvmBlockTag,\n percentiles: readonly number[],\n tags: EvmCallTags,\n ): Promise<EvmFeeHistory>;\n /** By number or tag, or by hash when `block` is a 0x-prefixed 32-byte hash. */\n getBlock(block: EvmBlockTag | string, tags: EvmCallTags): Promise<EvmBlock | null>;\n getBlockWithTransactions(\n block: bigint,\n tags: EvmCallTags,\n ): Promise<EvmFullBlock | null>;\n getTransaction(hash: string, tags: EvmCallTags): Promise<EvmTx | null>;\n getReceipt(hash: string, tags: EvmCallTags): Promise<EvmReceipt | null>;\n /**\n * Every receipt of the block with this hash, in block order (`eth_getBlockReceipts`):\n * read by block, so a node serves them without a transaction or log index. `null` for a\n * block the node does not know.\n */\n getBlockReceipts(\n blockHash: string,\n tags: EvmCallTags,\n ): Promise<readonly EvmReceipt[] | null>;\n getLogs(\n filter: { readonly blockHash: string; readonly topics: readonly (string | null)[] },\n tags: EvmCallTags,\n ): Promise<readonly EvmLog[]>;\n /** Resolves with the transaction hash the node reports. */\n sendRawTransaction(raw: string, tags: EvmCallTags): Promise<string>;\n /** Strict: `0x` and 40 hex digits; mixed case must be a valid EIP-55 checksum. */\n isAddress(value: string): boolean;\n /** EIP-55 checksum form; throws on an invalid address. */\n checksum(address: string): string;\n /** From a 33-byte compressed or 65-byte uncompressed secp256k1 public key. */\n addressFromPublicKey(publicKey: Uint8Array): string;\n serializeUnsigned(tx: EvmTxFields): string;\n /** The keccak-256 digest a signer signs. */\n unsignedHash(tx: EvmTxFields): string;\n serializeSigned(\n tx: EvmTxFields,\n signature: EvmSignature,\n ): { readonly raw: string; readonly hash: string };\n readonly abi: EvmAbi;\n /** A fresh SDK client on the same transport, for `crypto-aio/native`. */\n createNative(): DisposableNativeClient;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DisposableNativeClient } from '../../core/driver/types';
|
|
2
|
+
import type { Transport } from '../../core/transport/types';
|
|
3
|
+
import { EvmClientBase } from './client';
|
|
4
|
+
import type { EvmAbi, EvmCallTags, EvmSignature, EvmTxFields } from './types';
|
|
5
|
+
export declare class Web3Client extends EvmClientBase {
|
|
6
|
+
#private;
|
|
7
|
+
readonly library = "web3";
|
|
8
|
+
readonly abi: EvmAbi;
|
|
9
|
+
constructor(transport: Transport, chainId: bigint);
|
|
10
|
+
protected send(method: string, params: readonly unknown[], tags: EvmCallTags): Promise<unknown>;
|
|
11
|
+
isAddress(value: string): boolean;
|
|
12
|
+
checksum(address: string): string;
|
|
13
|
+
addressFromPublicKey(publicKey: Uint8Array): string;
|
|
14
|
+
protected encodeUnsigned(tx: EvmTxFields): string;
|
|
15
|
+
protected hashUnsigned(tx: EvmTxFields): string;
|
|
16
|
+
protected encodeSigned(tx: EvmTxFields, signature: EvmSignature): {
|
|
17
|
+
raw: string;
|
|
18
|
+
hash: string;
|
|
19
|
+
};
|
|
20
|
+
createNative(): DisposableNativeClient;
|
|
21
|
+
}
|
|
22
|
+
/** The `web3` adapter's driver factory; the manifest's `load()` returns it. */
|
|
23
|
+
export declare const web3DriverFactory: import("../../core/driver/types").DriverFactory;
|