crypto-aio 0.0.3 → 0.2.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 +167 -0
- package/README.md +163 -13
- 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 +386 -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 +175 -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 +139 -0
- package/dist/adapters/evm/ethers-client.js.map +1 -0
- package/dist/adapters/evm/fees.d.ts +103 -0
- package/dist/adapters/evm/fees.js +277 -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 +12 -0
- package/dist/adapters/evm/index.js.map +1 -0
- package/dist/adapters/evm/network.d.ts +65 -0
- package/dist/adapters/evm/network.js +150 -0
- package/dist/adapters/evm/network.js.map +1 -0
- package/dist/adapters/evm/plugin.d.ts +35 -0
- package/dist/adapters/evm/plugin.js +150 -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 +370 -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 +83 -0
- package/dist/adapters/evm/reader.js +326 -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 +10 -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 +265 -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 +26 -0
- package/dist/adapters/evm/web3-client.js +176 -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 +556 -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 +77 -0
- package/dist/adapters/solana/fees.js +214 -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/message.d.ts +15 -0
- package/dist/adapters/solana/message.js +120 -0
- package/dist/adapters/solana/message.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 +44 -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 +124 -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 +61 -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 +755 -0
- package/dist/adapters/ton/proofs.js.map +1 -0
- package/dist/adapters/ton/reader.d.ts +235 -0
- package/dist/adapters/ton/reader.js +976 -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 +74 -0
- package/dist/adapters/ton/trace.js +303 -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 +41 -0
- package/dist/adapters/tron/abi.js +112 -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 +569 -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 +52 -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 +371 -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 +57 -0
- package/dist/adapters/tron/reader.js +220 -0
- package/dist/adapters/tron/reader.js.map +1 -0
- package/dist/adapters/tron/tokens.d.ts +9 -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 +100 -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 +63 -0
- package/dist/adapters/utxo/context.js +125 -0
- package/dist/adapters/utxo/context.js.map +1 -0
- package/dist/adapters/utxo/decode.d.ts +22 -0
- package/dist/adapters/utxo/decode.js +121 -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 +79 -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 +100 -0
- package/dist/adapters/utxo/esplora.js +498 -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 +66 -0
- package/dist/adapters/utxo/proofs.js +469 -0
- package/dist/adapters/utxo/proofs.js.map +1 -0
- package/dist/adapters/utxo/rawblock.d.ts +46 -0
- package/dist/adapters/utxo/rawblock.js +159 -0
- package/dist/adapters/utxo/rawblock.js.map +1 -0
- package/dist/adapters/utxo/rawtx.d.ts +73 -0
- package/dist/adapters/utxo/rawtx.js +264 -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 +179 -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 +180 -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 +62 -0
- package/dist/core/container/container.js +500 -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 +379 -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 +163 -0
- package/dist/core/errors/codes.js +53 -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 +106 -0
- package/dist/core/lifecycle/engine-rules.js +267 -0
- package/dist/core/lifecycle/engine-rules.js.map +1 -0
- package/dist/core/lifecycle/engine.d.ts +502 -0
- package/dist/core/lifecycle/engine.js +1750 -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 +77 -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 +616 -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 +88 -0
- package/dist/core/lifecycle/workers.js +347 -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 +38 -0
- package/dist/core/model/ids.js +14 -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 +28 -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 +123 -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 +358 -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 +161 -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/format.d.ts +20 -0
- package/dist/core/store/format.js +86 -0
- package/dist/core/store/format.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 +258 -0
- package/dist/core/store/types.js +119 -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 +1703 -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 +159 -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 +35 -0
- package/dist/core/util/json.js +174 -0
- package/dist/core/util/json.js.map +1 -0
- package/dist/core/util/names.d.ts +27 -0
- package/dist/core/util/names.js +56 -0
- package/dist/core/util/names.js.map +1 -0
- package/dist/index.d.ts +65 -14
- package/dist/index.js +107 -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 +737 -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 +68 -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 +38 -0
- package/dist/testing/faulty-store.js +71 -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 +198 -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,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EVM_CHAINS = void 0;
|
|
4
|
+
const freeze_1 = require("../../core/util/freeze");
|
|
5
|
+
const FINALIZED_TAG = {
|
|
6
|
+
kind: 'tag',
|
|
7
|
+
tag: 'finalized',
|
|
8
|
+
fallbackConfirmations: 128,
|
|
9
|
+
};
|
|
10
|
+
function evmNetwork(chain, spec) {
|
|
11
|
+
return {
|
|
12
|
+
id: spec.id,
|
|
13
|
+
identity: String(spec.chainId),
|
|
14
|
+
testnet: spec.testnet,
|
|
15
|
+
feeModel: chain.feeModel,
|
|
16
|
+
finality: chain.finality ?? FINALIZED_TAG,
|
|
17
|
+
defaultConfirmations: 1,
|
|
18
|
+
reorgWindow: 128,
|
|
19
|
+
...(spec.maxLagBlocks !== undefined ? { maxLagBlocks: spec.maxLagBlocks } : {}),
|
|
20
|
+
...(spec.explorer !== undefined
|
|
21
|
+
? {
|
|
22
|
+
explorer: {
|
|
23
|
+
tx: `${spec.explorer}/tx/{id}`,
|
|
24
|
+
address: `${spec.explorer}/address/{address}`,
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
: {}),
|
|
28
|
+
...(chain.replacement === false ? {} : { replacement: { minBumpPercent: 10 } }),
|
|
29
|
+
...(chain.remove ? { capabilities: { remove: chain.remove } } : {}),
|
|
30
|
+
...(chain.params || spec.params
|
|
31
|
+
? { params: { ...chain.params, ...spec.params } }
|
|
32
|
+
: {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function evmChain(spec) {
|
|
36
|
+
return {
|
|
37
|
+
id: spec.id,
|
|
38
|
+
family: 'evm',
|
|
39
|
+
model: 'account',
|
|
40
|
+
ordering: 'nonce',
|
|
41
|
+
schemes: ['secp256k1-ecdsa'],
|
|
42
|
+
nativeAsset: { symbol: spec.symbol, decimals: 18, name: spec.name },
|
|
43
|
+
defaultNetwork: 'mainnet',
|
|
44
|
+
networks: Object.fromEntries(spec.networks.map((n) => [n.id, evmNetwork(spec, n)])),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const OP_STACK = { l1DataFee: 'op-stack' };
|
|
48
|
+
/**
|
|
49
|
+
* Frozen all the way down, as `BUILTIN_SCHEMES` is: networks share `FINALIZED_TAG`, and a
|
|
50
|
+
* chain's networks share its `remove` list, so no caller may change them.
|
|
51
|
+
*/
|
|
52
|
+
exports.EVM_CHAINS = (0, freeze_1.deepFreeze)([
|
|
53
|
+
evmChain({
|
|
54
|
+
id: 'ethereum',
|
|
55
|
+
symbol: 'ETH',
|
|
56
|
+
name: 'Ether',
|
|
57
|
+
feeModel: 'evm-1559',
|
|
58
|
+
networks: [
|
|
59
|
+
{ id: 'mainnet', chainId: 1, testnet: false, explorer: 'https://etherscan.io' },
|
|
60
|
+
{
|
|
61
|
+
id: 'sepolia',
|
|
62
|
+
chainId: 11155111,
|
|
63
|
+
testnet: true,
|
|
64
|
+
explorer: 'https://sepolia.etherscan.io',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'hoodi',
|
|
68
|
+
chainId: 560048,
|
|
69
|
+
testnet: true,
|
|
70
|
+
explorer: 'https://hoodi.etherscan.io',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
}),
|
|
74
|
+
evmChain({
|
|
75
|
+
id: 'bsc',
|
|
76
|
+
symbol: 'BNB',
|
|
77
|
+
name: 'BNB',
|
|
78
|
+
// BEP-226: type-2 transactions are accepted, but the base fee is always 0.
|
|
79
|
+
feeModel: 'evm-legacy',
|
|
80
|
+
remove: ['fee-market-1559'],
|
|
81
|
+
networks: [
|
|
82
|
+
{
|
|
83
|
+
id: 'mainnet',
|
|
84
|
+
chainId: 56,
|
|
85
|
+
testnet: false,
|
|
86
|
+
explorer: 'https://bscscan.com',
|
|
87
|
+
maxLagBlocks: 134,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'testnet',
|
|
91
|
+
chainId: 97,
|
|
92
|
+
testnet: true,
|
|
93
|
+
explorer: 'https://testnet.bscscan.com',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
evmChain({
|
|
98
|
+
id: 'polygon',
|
|
99
|
+
symbol: 'POL',
|
|
100
|
+
name: 'POL',
|
|
101
|
+
feeModel: 'evm-1559',
|
|
102
|
+
// bor, Polygon PoS's client, adds system logs to receipts.
|
|
103
|
+
params: { systemLogs: 'bor' },
|
|
104
|
+
networks: [
|
|
105
|
+
{
|
|
106
|
+
id: 'mainnet',
|
|
107
|
+
chainId: 137,
|
|
108
|
+
testnet: false,
|
|
109
|
+
explorer: 'https://polygonscan.com',
|
|
110
|
+
// The Polygon Gas Station docs: mainnet requires a 25 gwei priority fee.
|
|
111
|
+
params: { minPriorityFeePerGas: 25000000000n },
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'amoy',
|
|
115
|
+
chainId: 80002,
|
|
116
|
+
testnet: true,
|
|
117
|
+
explorer: 'https://amoy.polygonscan.com',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
}),
|
|
121
|
+
evmChain({
|
|
122
|
+
id: 'avalanche',
|
|
123
|
+
symbol: 'AVAX',
|
|
124
|
+
name: 'Avalanche',
|
|
125
|
+
feeModel: 'evm-1559',
|
|
126
|
+
// The C-Chain's `latest` block is final (accepted); it has no deeper finality to wait for.
|
|
127
|
+
finality: { kind: 'confirmations', confirmations: 1 },
|
|
128
|
+
remove: ['finality-tag'],
|
|
129
|
+
networks: [
|
|
130
|
+
{ id: 'mainnet', chainId: 43114, testnet: false },
|
|
131
|
+
{ id: 'fuji', chainId: 43113, testnet: true },
|
|
132
|
+
],
|
|
133
|
+
}),
|
|
134
|
+
evmChain({
|
|
135
|
+
id: 'arbitrum',
|
|
136
|
+
symbol: 'ETH',
|
|
137
|
+
name: 'Ether',
|
|
138
|
+
feeModel: 'evm-1559',
|
|
139
|
+
// No mempool: the sequencer runs transactions first come, first served.
|
|
140
|
+
replacement: false,
|
|
141
|
+
remove: ['replace-fee', 'cancel'],
|
|
142
|
+
networks: [
|
|
143
|
+
{
|
|
144
|
+
id: 'mainnet',
|
|
145
|
+
chainId: 42161,
|
|
146
|
+
testnet: false,
|
|
147
|
+
explorer: 'https://arbiscan.io',
|
|
148
|
+
maxLagBlocks: 240,
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'sepolia',
|
|
152
|
+
chainId: 421614,
|
|
153
|
+
testnet: true,
|
|
154
|
+
explorer: 'https://sepolia.arbiscan.io',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
}),
|
|
158
|
+
evmChain({
|
|
159
|
+
id: 'optimism',
|
|
160
|
+
symbol: 'ETH',
|
|
161
|
+
name: 'Ether',
|
|
162
|
+
feeModel: 'evm-1559',
|
|
163
|
+
params: OP_STACK,
|
|
164
|
+
networks: [
|
|
165
|
+
{
|
|
166
|
+
id: 'mainnet',
|
|
167
|
+
chainId: 10,
|
|
168
|
+
testnet: false,
|
|
169
|
+
explorer: 'https://explorer.optimism.io',
|
|
170
|
+
maxLagBlocks: 30,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 'sepolia',
|
|
174
|
+
chainId: 11155420,
|
|
175
|
+
testnet: true,
|
|
176
|
+
explorer: 'https://testnet-explorer.optimism.io',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
}),
|
|
180
|
+
evmChain({
|
|
181
|
+
id: 'base',
|
|
182
|
+
symbol: 'ETH',
|
|
183
|
+
name: 'Ether',
|
|
184
|
+
feeModel: 'evm-1559',
|
|
185
|
+
params: OP_STACK,
|
|
186
|
+
networks: [
|
|
187
|
+
{
|
|
188
|
+
id: 'mainnet',
|
|
189
|
+
chainId: 8453,
|
|
190
|
+
testnet: false,
|
|
191
|
+
explorer: 'https://basescan.org',
|
|
192
|
+
maxLagBlocks: 30,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 'sepolia',
|
|
196
|
+
chainId: 84532,
|
|
197
|
+
testnet: true,
|
|
198
|
+
explorer: 'https://sepolia.basescan.org',
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
}),
|
|
202
|
+
]);
|
|
203
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../src/adapters/evm/chains.ts"],"names":[],"mappings":";;;AAaA,mDAAoD;AAEpD,MAAM,aAAa,GAAmB;IACpC,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,WAAW;IAChB,qBAAqB,EAAE,GAAG;CAC3B,CAAC;AAyBF,SAAS,UAAU,CAAC,KAAgB,EAAE,IAAiB;IACrD,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;Q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O,EAAE,IAAI;gBACb,QAAQ,EAAE,8BAA8B;aACzC;SACF;KACF,CAAC;CACH,CAAC,CAAC","sourcesContent":["/**\n * Built-in EVM chains and networks. Every value is verified against the chain's own\n * documentation or its EIP, or is a documented library policy; what could not be verified\n * (an Avalanche explorer, most testnets' block times) is left out:\n * - `defaultConfirmations: 1`: `waitForConfirmation` waits for inclusion by default;\n * credit deposits on `final`.\n * - `reorgWindow: 128` and `fallbackConfirmations: 128`: the library's scanner window. The\n * EVM driver never falls back from the `finalized` tag to confirmations.\n * - `maxLagBlocks`: about 60 seconds of blocks, only where the block time is verified.\n * - `replacement.minBumpPercent: 10`: the spec's default (geth's `--txpool.pricebump`).\n */\nimport type { KnownCapability } from '../../core/model/capability';\nimport type { ChainInfo, FinalityPolicy, NetworkInfo } from '../../core/model/chain';\nimport { deepFreeze } from '../../core/util/freeze';\n\nconst FINALIZED_TAG: FinalityPolicy = {\n kind: 'tag',\n tag: 'finalized',\n fallbackConfirmations: 128,\n};\n\ninterface NetworkSpec {\n readonly id: string;\n readonly chainId: number;\n readonly testnet: boolean;\n readonly explorer?: string;\n readonly maxLagBlocks?: number;\n readonly params?: Readonly<Record<string, unknown>>;\n}\n\ninterface ChainSpec {\n readonly id: string;\n readonly symbol: string;\n readonly name: string;\n readonly feeModel: 'evm-1559' | 'evm-legacy';\n readonly finality?: FinalityPolicy;\n /** Network capabilities removed from the EVM manifests' list. */\n readonly remove?: readonly KnownCapability[];\n /** `false` on chains without a mempool to replace transactions in (Arbitrum). */\n readonly replacement?: boolean;\n readonly params?: Readonly<Record<string, unknown>>;\n readonly networks: readonly NetworkSpec[];\n}\n\nfunction evmNetwork(chain: ChainSpec, spec: NetworkSpec): NetworkInfo {\n return {\n id: spec.id,\n identity: String(spec.chainId),\n testnet: spec.testnet,\n feeModel: chain.feeModel,\n finality: chain.finality ?? FINALIZED_TAG,\n defaultConfirmations: 1,\n reorgWindow: 128,\n ...(spec.maxLagBlocks !== undefined ? { maxLagBlocks: spec.maxLagBlocks } : {}),\n ...(spec.explorer !== undefined\n ? {\n explorer: {\n tx: `${spec.explorer}/tx/{id}`,\n address: `${spec.explorer}/address/{address}`,\n },\n }\n : {}),\n ...(chain.replacement === false ? {} : { replacement: { minBumpPercent: 10 } }),\n ...(chain.remove ? { capabilities: { remove: chain.remove } } : {}),\n ...(chain.params || spec.params\n ? { params: { ...chain.params, ...spec.params } }\n : {}),\n };\n}\n\nfunction evmChain(spec: ChainSpec): ChainInfo {\n return {\n id: spec.id,\n family: 'evm',\n model: 'account',\n ordering: 'nonce',\n schemes: ['secp256k1-ecdsa'],\n nativeAsset: { symbol: spec.symbol, decimals: 18, name: spec.name },\n defaultNetwork: 'mainnet',\n networks: Object.fromEntries(spec.networks.map((n) => [n.id, evmNetwork(spec, n)])),\n };\n}\n\nconst OP_STACK = { l1DataFee: 'op-stack' } as const;\n\n/**\n * Frozen all the way down, as `BUILTIN_SCHEMES` is: networks share `FINALIZED_TAG`, and a\n * chain's networks share its `remove` list, so no caller may change them.\n */\nexport const EVM_CHAINS: readonly ChainInfo[] = deepFreeze([\n evmChain({\n id: 'ethereum',\n symbol: 'ETH',\n name: 'Ether',\n feeModel: 'evm-1559',\n networks: [\n { id: 'mainnet', chainId: 1, testnet: false, explorer: 'https://etherscan.io' },\n {\n id: 'sepolia',\n chainId: 11155111,\n testnet: true,\n explorer: 'https://sepolia.etherscan.io',\n },\n {\n id: 'hoodi',\n chainId: 560048,\n testnet: true,\n explorer: 'https://hoodi.etherscan.io',\n },\n ],\n }),\n evmChain({\n id: 'bsc',\n symbol: 'BNB',\n name: 'BNB',\n // BEP-226: type-2 transactions are accepted, but the base fee is always 0.\n feeModel: 'evm-legacy',\n remove: ['fee-market-1559'],\n networks: [\n {\n id: 'mainnet',\n chainId: 56,\n testnet: false,\n explorer: 'https://bscscan.com',\n maxLagBlocks: 134,\n },\n {\n id: 'testnet',\n chainId: 97,\n testnet: true,\n explorer: 'https://testnet.bscscan.com',\n },\n ],\n }),\n evmChain({\n id: 'polygon',\n symbol: 'POL',\n name: 'POL',\n feeModel: 'evm-1559',\n // bor, Polygon PoS's client, adds system logs to receipts.\n params: { systemLogs: 'bor' },\n networks: [\n {\n id: 'mainnet',\n chainId: 137,\n testnet: false,\n explorer: 'https://polygonscan.com',\n // The Polygon Gas Station docs: mainnet requires a 25 gwei priority fee.\n params: { minPriorityFeePerGas: 25_000_000_000n },\n },\n {\n id: 'amoy',\n chainId: 80002,\n testnet: true,\n explorer: 'https://amoy.polygonscan.com',\n },\n ],\n }),\n evmChain({\n id: 'avalanche',\n symbol: 'AVAX',\n name: 'Avalanche',\n feeModel: 'evm-1559',\n // The C-Chain's `latest` block is final (accepted); it has no deeper finality to wait for.\n finality: { kind: 'confirmations', confirmations: 1 },\n remove: ['finality-tag'],\n networks: [\n { id: 'mainnet', chainId: 43114, testnet: false },\n { id: 'fuji', chainId: 43113, testnet: true },\n ],\n }),\n evmChain({\n id: 'arbitrum',\n symbol: 'ETH',\n name: 'Ether',\n feeModel: 'evm-1559',\n // No mempool: the sequencer runs transactions first come, first served.\n replacement: false,\n remove: ['replace-fee', 'cancel'],\n networks: [\n {\n id: 'mainnet',\n chainId: 42161,\n testnet: false,\n explorer: 'https://arbiscan.io',\n maxLagBlocks: 240,\n },\n {\n id: 'sepolia',\n chainId: 421614,\n testnet: true,\n explorer: 'https://sepolia.arbiscan.io',\n },\n ],\n }),\n evmChain({\n id: 'optimism',\n symbol: 'ETH',\n name: 'Ether',\n feeModel: 'evm-1559',\n params: OP_STACK,\n networks: [\n {\n id: 'mainnet',\n chainId: 10,\n testnet: false,\n explorer: 'https://explorer.optimism.io',\n maxLagBlocks: 30,\n },\n {\n id: 'sepolia',\n chainId: 11155420,\n testnet: true,\n explorer: 'https://testnet-explorer.optimism.io',\n },\n ],\n }),\n evmChain({\n id: 'base',\n symbol: 'ETH',\n name: 'Ether',\n feeModel: 'evm-1559',\n params: OP_STACK,\n networks: [\n {\n id: 'mainnet',\n chainId: 8453,\n testnet: false,\n explorer: 'https://basescan.org',\n maxLagBlocks: 30,\n },\n {\n id: 'sepolia',\n chainId: 84532,\n testnet: true,\n explorer: 'https://sepolia.basescan.org',\n },\n ],\n }),\n]);\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { DisposableNativeClient } from '../../core/driver/types';
|
|
2
|
+
import type { EvmAbi, EvmBlock, EvmBlockTag, EvmCallRequest, EvmCallTags, EvmClient, EvmFeeHistory, EvmFullBlock, EvmLog, EvmReceipt, EvmSignature, EvmTx, EvmTxFields } from './types';
|
|
3
|
+
/** `0x` and 40 hex digits; the checksum is the SDK's to check. */
|
|
4
|
+
export declare const ADDRESS: RegExp;
|
|
5
|
+
/**
|
|
6
|
+
* The 65-byte uncompressed form of a secp256k1 public key, accepted only as a 33-byte
|
|
7
|
+
* compressed key (`0x02`/`0x03`) or a 65-byte `0x04` key that decodes to a point on the
|
|
8
|
+
* curve. Both clients derive addresses from its result, never from the caller's bytes: an
|
|
9
|
+
* SDK may read 32 bytes as a *private* key or 64 bytes as an unprefixed public key, and
|
|
10
|
+
* either would yield an address nobody holds the key to. The error never echoes the input.
|
|
11
|
+
*/
|
|
12
|
+
export declare function uncompressedPublicKey(publicKey: Uint8Array): Uint8Array;
|
|
13
|
+
/**
|
|
14
|
+
* A JSON-RPC quantity (`0x` and hex digits) as a bigint. Anything else throws a retryable
|
|
15
|
+
* `PROVIDER_UNAVAILABLE` naming `field`: the one check of every hex quantity the driver
|
|
16
|
+
* reads, quorum keys and health probes included (a key that throws is a disagreement).
|
|
17
|
+
*/
|
|
18
|
+
export declare function quantity(value: unknown, field: string): bigint;
|
|
19
|
+
/** One ABI word: 32 bytes. */
|
|
20
|
+
export declare const ABI_WORD: RegExp;
|
|
21
|
+
/** An ABI-encoded address: 12 zero bytes, then 20 address bytes. */
|
|
22
|
+
export declare const ADDRESS_WORD: RegExp;
|
|
23
|
+
/**
|
|
24
|
+
* The three ABI words of an ERC-20 `Transfer` log (`from`, `to`, amount), or `null`. Anyone
|
|
25
|
+
* can emit a look-alike event: anything but the topic and three well-formed words is not a
|
|
26
|
+
* transfer, and never an error that would fail a whole block scan.
|
|
27
|
+
*/
|
|
28
|
+
export declare function transferLogWords(log: {
|
|
29
|
+
readonly topics: readonly string[];
|
|
30
|
+
readonly data: string;
|
|
31
|
+
}, topic: string): {
|
|
32
|
+
readonly from: string;
|
|
33
|
+
readonly to: string;
|
|
34
|
+
readonly data: string;
|
|
35
|
+
} | null;
|
|
36
|
+
export declare function blockParam(block: EvmBlockTag): string;
|
|
37
|
+
export declare abstract class EvmClientBase implements EvmClient {
|
|
38
|
+
#private;
|
|
39
|
+
abstract readonly library: string;
|
|
40
|
+
abstract readonly abi: EvmAbi;
|
|
41
|
+
/** The chain id of the network this client serves. */
|
|
42
|
+
protected readonly chainId: bigint;
|
|
43
|
+
constructor(chainId: bigint);
|
|
44
|
+
/** One JSON-RPC request through the SDK's bridge, under `tags`; resolves with `result`. */
|
|
45
|
+
protected abstract send(method: string, params: readonly unknown[], tags: EvmCallTags): Promise<unknown>;
|
|
46
|
+
abstract isAddress(value: string): boolean;
|
|
47
|
+
abstract checksum(address: string): string;
|
|
48
|
+
abstract addressFromPublicKey(publicKey: Uint8Array): string;
|
|
49
|
+
abstract createNative(): DisposableNativeClient;
|
|
50
|
+
/** The SDK codec, reached only through the chain-id guard below. */
|
|
51
|
+
protected abstract encodeUnsigned(tx: EvmTxFields): string;
|
|
52
|
+
protected abstract hashUnsigned(tx: EvmTxFields): string;
|
|
53
|
+
protected abstract encodeSigned(tx: EvmTxFields, signature: EvmSignature): {
|
|
54
|
+
readonly raw: string;
|
|
55
|
+
readonly hash: string;
|
|
56
|
+
};
|
|
57
|
+
serializeUnsigned(tx: EvmTxFields): string;
|
|
58
|
+
unsignedHash(tx: EvmTxFields): string;
|
|
59
|
+
serializeSigned(tx: EvmTxFields, signature: EvmSignature): {
|
|
60
|
+
readonly raw: string;
|
|
61
|
+
readonly hash: string;
|
|
62
|
+
};
|
|
63
|
+
/** Runs the SDK's checksum; `INVALID_ADDRESS` for anything but a valid hex address. */
|
|
64
|
+
protected checked(address: string, checksum: (value: string) => string): string;
|
|
65
|
+
blockNumber(tags: EvmCallTags): Promise<bigint>;
|
|
66
|
+
getBalance(address: string, block: EvmBlockTag, tags: EvmCallTags): Promise<bigint>;
|
|
67
|
+
getTransactionCount(address: string, block: EvmBlockTag, tags: EvmCallTags): Promise<bigint>;
|
|
68
|
+
call(request: EvmCallRequest, block: EvmBlockTag, tags: EvmCallTags): Promise<string>;
|
|
69
|
+
estimateGas(request: EvmCallRequest, tags: EvmCallTags): Promise<bigint>;
|
|
70
|
+
gasPrice(tags: EvmCallTags): Promise<bigint>;
|
|
71
|
+
feeHistory(blockCount: number, newest: EvmBlockTag, percentiles: readonly number[], tags: EvmCallTags): Promise<EvmFeeHistory>;
|
|
72
|
+
getBlock(block: EvmBlockTag | string, tags: EvmCallTags): Promise<EvmBlock | null>;
|
|
73
|
+
getBlockWithTransactions(block: bigint, tags: EvmCallTags): Promise<EvmFullBlock | null>;
|
|
74
|
+
/** An answer about another transaction is malformed, never another's facts. */
|
|
75
|
+
getTransaction(txHash: string, tags: EvmCallTags): Promise<EvmTx | null>;
|
|
76
|
+
/** An answer about another transaction is malformed, never another's receipt. */
|
|
77
|
+
getReceipt(txHash: string, tags: EvmCallTags): Promise<EvmReceipt | null>;
|
|
78
|
+
getBlockReceipts(blockHash: string, tags: EvmCallTags): Promise<readonly EvmReceipt[] | null>;
|
|
79
|
+
getLogs(filter: {
|
|
80
|
+
readonly blockHash: string;
|
|
81
|
+
readonly topics: readonly (string | null)[];
|
|
82
|
+
}, tags: EvmCallTags): Promise<readonly EvmLog[]>;
|
|
83
|
+
sendRawTransaction(raw: string, tags: EvmCallTags): Promise<string>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EvmClientBase = exports.ADDRESS_WORD = exports.ABI_WORD = exports.ADDRESS = void 0;
|
|
4
|
+
exports.uncompressedPublicKey = uncompressedPublicKey;
|
|
5
|
+
exports.quantity = quantity;
|
|
6
|
+
exports.transferLogWords = transferLogWords;
|
|
7
|
+
exports.blockParam = blockParam;
|
|
8
|
+
/**
|
|
9
|
+
* The SDK-free half of every `EvmClient`: the JSON-RPC methods the driver calls and the
|
|
10
|
+
* normalization of their answers into plain data. A subclass supplies the SDK half: the
|
|
11
|
+
* `send` bridge (the SDK's own JSON-RPC primitive, wired to the transport) and the codec.
|
|
12
|
+
*
|
|
13
|
+
* I/O never uses an SDK's high-level helpers: those
|
|
14
|
+
* issue extra calls under the wrong tags (ethers `broadcastTransaction` also reads the block
|
|
15
|
+
* number; `getTransactionReceipt` may fetch the transaction), throw on not-found (web3
|
|
16
|
+
* `TransactionNotFound`) or drop chain fields the fees need (OP `l1Fee`, Arbitrum
|
|
17
|
+
* `gasUsedForL1`). So one driver call is exactly one tagged JSON-RPC request.
|
|
18
|
+
*/
|
|
19
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
|
20
|
+
const error_1 = require("../../core/errors/error");
|
|
21
|
+
/** `0x` and 40 hex digits; the checksum is the SDK's to check. */
|
|
22
|
+
exports.ADDRESS = /^0x[0-9a-fA-F]{40}$/;
|
|
23
|
+
/**
|
|
24
|
+
* The 65-byte uncompressed form of a secp256k1 public key, accepted only as a 33-byte
|
|
25
|
+
* compressed key (`0x02`/`0x03`) or a 65-byte `0x04` key that decodes to a point on the
|
|
26
|
+
* curve. Both clients derive addresses from its result, never from the caller's bytes: an
|
|
27
|
+
* SDK may read 32 bytes as a *private* key or 64 bytes as an unprefixed public key, and
|
|
28
|
+
* either would yield an address nobody holds the key to. The error never echoes the input.
|
|
29
|
+
*/
|
|
30
|
+
function uncompressedPublicKey(publicKey) {
|
|
31
|
+
const prefix = publicKey instanceof Uint8Array ? publicKey[0] : undefined;
|
|
32
|
+
const shaped = ((prefix === 0x02 || prefix === 0x03) && publicKey.length === 33) ||
|
|
33
|
+
(prefix === 0x04 && publicKey.length === 65);
|
|
34
|
+
try {
|
|
35
|
+
if (shaped)
|
|
36
|
+
return secp256k1_1.secp256k1.ProjectivePoint.fromHex(publicKey).toRawBytes(false);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// Not a point on the curve.
|
|
40
|
+
}
|
|
41
|
+
throw new error_1.ValidationError('INVALID_ADDRESS', 'public key must be a 33- or 65-byte secp256k1 point');
|
|
42
|
+
}
|
|
43
|
+
const HASH = /^0x[0-9a-fA-F]{64}$/;
|
|
44
|
+
const QUANTITY = /^0x[0-9a-fA-F]+$/;
|
|
45
|
+
const DATA = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
46
|
+
const BLOOM = /^0x[0-9a-fA-F]{512}$/;
|
|
47
|
+
function malformed(field) {
|
|
48
|
+
return new error_1.ProviderError('PROVIDER_UNAVAILABLE', `malformed ${field} in a JSON-RPC answer`);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A JSON-RPC quantity (`0x` and hex digits) as a bigint. Anything else throws a retryable
|
|
52
|
+
* `PROVIDER_UNAVAILABLE` naming `field`: the one check of every hex quantity the driver
|
|
53
|
+
* reads, quorum keys and health probes included (a key that throws is a disagreement).
|
|
54
|
+
*/
|
|
55
|
+
function quantity(value, field) {
|
|
56
|
+
if (typeof value !== 'string' || !QUANTITY.test(value))
|
|
57
|
+
throw malformed(field);
|
|
58
|
+
return BigInt(value);
|
|
59
|
+
}
|
|
60
|
+
function optionalQuantity(value, field) {
|
|
61
|
+
return value === undefined || value === null ? undefined : quantity(value, field);
|
|
62
|
+
}
|
|
63
|
+
function hash(value, field) {
|
|
64
|
+
if (typeof value !== 'string' || !HASH.test(value))
|
|
65
|
+
throw malformed(field);
|
|
66
|
+
return value.toLowerCase();
|
|
67
|
+
}
|
|
68
|
+
function data(value, field) {
|
|
69
|
+
if (typeof value !== 'string' || !DATA.test(value))
|
|
70
|
+
throw malformed(field);
|
|
71
|
+
return value.toLowerCase();
|
|
72
|
+
}
|
|
73
|
+
function object(value, field) {
|
|
74
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
75
|
+
throw malformed(field);
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
/** One ABI word: 32 bytes. */
|
|
79
|
+
exports.ABI_WORD = /^0x[0-9a-fA-F]{64}$/;
|
|
80
|
+
/** An ABI-encoded address: 12 zero bytes, then 20 address bytes. */
|
|
81
|
+
exports.ADDRESS_WORD = /^0x0{24}[0-9a-fA-F]{40}$/;
|
|
82
|
+
/**
|
|
83
|
+
* The three ABI words of an ERC-20 `Transfer` log (`from`, `to`, amount), or `null`. Anyone
|
|
84
|
+
* can emit a look-alike event: anything but the topic and three well-formed words is not a
|
|
85
|
+
* transfer, and never an error that would fail a whole block scan.
|
|
86
|
+
*/
|
|
87
|
+
function transferLogWords(log, topic) {
|
|
88
|
+
const [first, from, to] = log.topics;
|
|
89
|
+
if (log.topics.length !== 3 ||
|
|
90
|
+
first !== topic ||
|
|
91
|
+
!exports.ADDRESS_WORD.test(from) ||
|
|
92
|
+
!exports.ADDRESS_WORD.test(to) ||
|
|
93
|
+
!exports.ABI_WORD.test(log.data)) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return { from: from, to: to, data: log.data };
|
|
97
|
+
}
|
|
98
|
+
function blockParam(block) {
|
|
99
|
+
return typeof block === 'bigint' ? `0x${block.toString(16)}` : block;
|
|
100
|
+
}
|
|
101
|
+
const hexOf = (value) => `0x${value.toString(16)}`;
|
|
102
|
+
class EvmClientBase {
|
|
103
|
+
/** The chain id of the network this client serves. */
|
|
104
|
+
chainId;
|
|
105
|
+
constructor(chainId) {
|
|
106
|
+
this.chainId = chainId;
|
|
107
|
+
}
|
|
108
|
+
serializeUnsigned(tx) {
|
|
109
|
+
return this.encodeUnsigned(this.#onNetwork(tx));
|
|
110
|
+
}
|
|
111
|
+
unsignedHash(tx) {
|
|
112
|
+
return this.hashUnsigned(this.#onNetwork(tx));
|
|
113
|
+
}
|
|
114
|
+
serializeSigned(tx, signature) {
|
|
115
|
+
return this.encodeSigned(this.#onNetwork(tx), signature);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A transaction for another chain is refused before any codec work. The SDKs
|
|
119
|
+
* disagree about it: ethers commits to `tx.chainId`, web3 to the client's chain id (and
|
|
120
|
+
* throws a plain `Error` for a type-2 mismatch), so without this guard the two clients
|
|
121
|
+
* would produce different signing bytes for the same fields.
|
|
122
|
+
*/
|
|
123
|
+
#onNetwork(tx) {
|
|
124
|
+
if (tx.chainId !== this.chainId) {
|
|
125
|
+
throw new error_1.ValidationError('INVALID_INTENT', 'transaction chain id does not match the network');
|
|
126
|
+
}
|
|
127
|
+
return tx;
|
|
128
|
+
}
|
|
129
|
+
/** Runs the SDK's checksum; `INVALID_ADDRESS` for anything but a valid hex address. */
|
|
130
|
+
checked(address, checksum) {
|
|
131
|
+
try {
|
|
132
|
+
if (exports.ADDRESS.test(address))
|
|
133
|
+
return checksum(address);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// A mixed-case address with a wrong checksum.
|
|
137
|
+
}
|
|
138
|
+
throw new error_1.ValidationError('INVALID_ADDRESS', 'not an EVM address');
|
|
139
|
+
}
|
|
140
|
+
async blockNumber(tags) {
|
|
141
|
+
return quantity(await this.send('eth_blockNumber', [], tags), 'block number');
|
|
142
|
+
}
|
|
143
|
+
async getBalance(address, block, tags) {
|
|
144
|
+
const result = await this.send('eth_getBalance', [address, blockParam(block)], tags);
|
|
145
|
+
return quantity(result, 'balance');
|
|
146
|
+
}
|
|
147
|
+
async getTransactionCount(address, block, tags) {
|
|
148
|
+
const params = [address, blockParam(block)];
|
|
149
|
+
return quantity(await this.send('eth_getTransactionCount', params, tags), 'nonce');
|
|
150
|
+
}
|
|
151
|
+
async call(request, block, tags) {
|
|
152
|
+
const result = await this.send('eth_call', [this.#request(request), blockParam(block)], tags);
|
|
153
|
+
return data(result, 'call result');
|
|
154
|
+
}
|
|
155
|
+
async estimateGas(request, tags) {
|
|
156
|
+
return quantity(await this.send('eth_estimateGas', [this.#request(request)], tags), 'gas');
|
|
157
|
+
}
|
|
158
|
+
async gasPrice(tags) {
|
|
159
|
+
return quantity(await this.send('eth_gasPrice', [], tags), 'gas price');
|
|
160
|
+
}
|
|
161
|
+
async feeHistory(blockCount, newest, percentiles, tags) {
|
|
162
|
+
const params = [hexOf(BigInt(blockCount)), blockParam(newest), [...percentiles]];
|
|
163
|
+
const json = object(await this.send('eth_feeHistory', params, tags), 'fee history');
|
|
164
|
+
const list = (value, field) => {
|
|
165
|
+
if (!Array.isArray(value))
|
|
166
|
+
throw malformed(field);
|
|
167
|
+
return value;
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
oldestBlock: quantity(json.oldestBlock, 'oldest block'),
|
|
171
|
+
baseFeePerGas: list(json.baseFeePerGas, 'base fees').map((v) => quantity(v, 'base fee')),
|
|
172
|
+
reward: list(json.reward ?? [], 'rewards').map((row) => list(row, 'rewards').map((v) => quantity(v, 'reward'))),
|
|
173
|
+
gasUsedRatio: list(json.gasUsedRatio ?? [], 'gas used ratios').map((v) => {
|
|
174
|
+
if (typeof v !== 'number')
|
|
175
|
+
throw malformed('gas used ratio');
|
|
176
|
+
return v;
|
|
177
|
+
}),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async getBlock(block, tags) {
|
|
181
|
+
const byHash = typeof block === 'string' && HASH.test(block);
|
|
182
|
+
const result = byHash
|
|
183
|
+
? await this.send('eth_getBlockByHash', [block, false], tags)
|
|
184
|
+
: await this.send('eth_getBlockByNumber', [blockParam(block), false], tags);
|
|
185
|
+
if (result === null)
|
|
186
|
+
return null;
|
|
187
|
+
const json = object(result, 'block');
|
|
188
|
+
return {
|
|
189
|
+
...this.#header(json),
|
|
190
|
+
transactions: this.#list(json.transactions, 'block transactions').map((t) => hash(typeof t === 'string' ? t : t?.hash, 'transaction hash')),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
async getBlockWithTransactions(block, tags) {
|
|
194
|
+
const result = await this.send('eth_getBlockByNumber', [blockParam(block), true], tags);
|
|
195
|
+
if (result === null)
|
|
196
|
+
return null;
|
|
197
|
+
const json = object(result, 'block');
|
|
198
|
+
const { logsBloom } = json;
|
|
199
|
+
return {
|
|
200
|
+
...this.#header(json),
|
|
201
|
+
transactions: this.#list(json.transactions, 'block transactions').map((t) => this.#tx(object(t, 'transaction'))),
|
|
202
|
+
// Only a hint for scans: a missing or malformed bloom may hold anything.
|
|
203
|
+
...(typeof logsBloom === 'string' && BLOOM.test(logsBloom)
|
|
204
|
+
? { logsBloom: logsBloom.toLowerCase() }
|
|
205
|
+
: {}),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/** An answer about another transaction is malformed, never another's facts. */
|
|
209
|
+
async getTransaction(txHash, tags) {
|
|
210
|
+
const result = await this.send('eth_getTransactionByHash', [txHash], tags);
|
|
211
|
+
if (result === null)
|
|
212
|
+
return null;
|
|
213
|
+
const tx = this.#tx(object(result, 'transaction'));
|
|
214
|
+
if (tx.hash !== txHash.toLowerCase())
|
|
215
|
+
throw malformed('transaction hash');
|
|
216
|
+
return tx;
|
|
217
|
+
}
|
|
218
|
+
/** An answer about another transaction is malformed, never another's receipt. */
|
|
219
|
+
async getReceipt(txHash, tags) {
|
|
220
|
+
const result = await this.send('eth_getTransactionReceipt', [txHash], tags);
|
|
221
|
+
if (result === null)
|
|
222
|
+
return null;
|
|
223
|
+
const receipt = this.#receipt(object(result, 'receipt'));
|
|
224
|
+
if (receipt.transactionHash !== txHash.toLowerCase()) {
|
|
225
|
+
throw malformed('transaction hash');
|
|
226
|
+
}
|
|
227
|
+
return receipt;
|
|
228
|
+
}
|
|
229
|
+
async getBlockReceipts(blockHash, tags) {
|
|
230
|
+
const result = await this.send('eth_getBlockReceipts', [blockHash], tags);
|
|
231
|
+
if (result === null)
|
|
232
|
+
return null;
|
|
233
|
+
return this.#list(result, 'block receipts').map((receipt) => this.#receipt(object(receipt, 'receipt')));
|
|
234
|
+
}
|
|
235
|
+
#receipt(json) {
|
|
236
|
+
const status = quantity(json.status, 'receipt status');
|
|
237
|
+
if (status !== 0n && status !== 1n)
|
|
238
|
+
throw malformed('receipt status');
|
|
239
|
+
const l1Fee = optionalQuantity(json.l1Fee, 'L1 fee');
|
|
240
|
+
const gasUsedForL1 = optionalQuantity(json.gasUsedForL1, 'L1 gas');
|
|
241
|
+
return {
|
|
242
|
+
transactionHash: hash(json.transactionHash, 'transaction hash'),
|
|
243
|
+
blockHash: hash(json.blockHash, 'block hash'),
|
|
244
|
+
blockNumber: quantity(json.blockNumber, 'block number'),
|
|
245
|
+
status: status === 1n ? 1 : 0,
|
|
246
|
+
from: this.#address(json.from, 'sender'),
|
|
247
|
+
to: json.to === null || json.to === undefined
|
|
248
|
+
? null
|
|
249
|
+
: this.#address(json.to, 'recipient'),
|
|
250
|
+
contractAddress: json.contractAddress === null || json.contractAddress === undefined
|
|
251
|
+
? null
|
|
252
|
+
: this.#address(json.contractAddress, 'contract address'),
|
|
253
|
+
gasUsed: quantity(json.gasUsed, 'gas used'),
|
|
254
|
+
effectiveGasPrice: quantity(json.effectiveGasPrice, 'effective gas price'),
|
|
255
|
+
...(l1Fee !== undefined ? { l1Fee } : {}),
|
|
256
|
+
...(gasUsedForL1 !== undefined ? { gasUsedForL1 } : {}),
|
|
257
|
+
logs: this.#list(json.logs, 'receipt logs').map((log) => this.#log(object(log, 'log'))),
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
async getLogs(filter, tags) {
|
|
261
|
+
const params = [{ blockHash: filter.blockHash, topics: [...filter.topics] }];
|
|
262
|
+
const result = await this.send('eth_getLogs', params, tags);
|
|
263
|
+
return this.#list(result, 'logs').map((log) => this.#log(object(log, 'log')));
|
|
264
|
+
}
|
|
265
|
+
async sendRawTransaction(raw, tags) {
|
|
266
|
+
return hash(await this.send('eth_sendRawTransaction', [raw], tags), 'transaction hash');
|
|
267
|
+
}
|
|
268
|
+
#request(request) {
|
|
269
|
+
return {
|
|
270
|
+
...(request.from !== undefined ? { from: request.from } : {}),
|
|
271
|
+
to: request.to,
|
|
272
|
+
...(request.value !== undefined ? { value: hexOf(request.value) } : {}),
|
|
273
|
+
...(request.data !== undefined ? { data: request.data } : {}),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
#list(value, field) {
|
|
277
|
+
if (!Array.isArray(value))
|
|
278
|
+
throw malformed(field);
|
|
279
|
+
return value;
|
|
280
|
+
}
|
|
281
|
+
#address(value, field) {
|
|
282
|
+
if (typeof value !== 'string' || !exports.ADDRESS.test(value))
|
|
283
|
+
throw malformed(field);
|
|
284
|
+
return this.checksum(value.toLowerCase());
|
|
285
|
+
}
|
|
286
|
+
#header(json) {
|
|
287
|
+
const baseFeePerGas = optionalQuantity(json.baseFeePerGas, 'base fee');
|
|
288
|
+
return {
|
|
289
|
+
number: quantity(json.number, 'block number'),
|
|
290
|
+
hash: hash(json.hash, 'block hash'),
|
|
291
|
+
parentHash: hash(json.parentHash, 'parent hash'),
|
|
292
|
+
timestamp: Number(quantity(json.timestamp, 'timestamp')),
|
|
293
|
+
...(baseFeePerGas !== undefined ? { baseFeePerGas } : {}),
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
#tx(json) {
|
|
297
|
+
const gasPrice = optionalQuantity(json.gasPrice, 'gas price');
|
|
298
|
+
const maxFeePerGas = optionalQuantity(json.maxFeePerGas, 'max fee');
|
|
299
|
+
const maxPriorityFeePerGas = optionalQuantity(json.maxPriorityFeePerGas, 'priority fee');
|
|
300
|
+
const blockHash = json.blockHash ?? null;
|
|
301
|
+
const blockNumber = json.blockNumber ?? null;
|
|
302
|
+
return {
|
|
303
|
+
hash: hash(json.hash, 'transaction hash'),
|
|
304
|
+
from: this.#address(json.from, 'sender'),
|
|
305
|
+
to: json.to === null || json.to === undefined
|
|
306
|
+
? null
|
|
307
|
+
: this.#address(json.to, 'recipient'),
|
|
308
|
+
nonce: quantity(json.nonce, 'nonce'),
|
|
309
|
+
value: quantity(json.value, 'value'),
|
|
310
|
+
// No calldata field is malformed, never an empty call (older nodes say `data`).
|
|
311
|
+
input: data(json.input ?? json.data, 'input'),
|
|
312
|
+
type: Number(optionalQuantity(json.type, 'type') ?? 0n),
|
|
313
|
+
gasLimit: quantity(json.gas, 'gas limit'),
|
|
314
|
+
...(gasPrice !== undefined ? { gasPrice } : {}),
|
|
315
|
+
...(maxFeePerGas !== undefined ? { maxFeePerGas } : {}),
|
|
316
|
+
...(maxPriorityFeePerGas !== undefined ? { maxPriorityFeePerGas } : {}),
|
|
317
|
+
blockHash: blockHash === null ? null : hash(blockHash, 'block hash'),
|
|
318
|
+
blockNumber: blockNumber === null ? null : quantity(blockNumber, 'block number'),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
#log(json) {
|
|
322
|
+
return {
|
|
323
|
+
address: this.#address(json.address, 'log address'),
|
|
324
|
+
topics: this.#list(json.topics, 'log topics').map((t) => hash(t, 'log topic')),
|
|
325
|
+
data: data(json.data, 'log data'),
|
|
326
|
+
logIndex: Number(quantity(json.logIndex, 'log index')),
|
|
327
|
+
blockHash: hash(json.blockHash, 'block hash'),
|
|
328
|
+
blockNumber: quantity(json.blockNumber, 'block number'),
|
|
329
|
+
transactionHash: hash(json.transactionHash, 'transaction hash'),
|
|
330
|
+
removed: json.removed === true,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
exports.EvmClientBase = EvmClientBase;
|
|
335
|
+
//# sourceMappingURL=client.js.map
|