crypto-aio 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +144 -14
- package/dist/adapters/avalanche/address.d.ts +15 -0
- package/dist/adapters/avalanche/address.js +74 -0
- package/dist/adapters/avalanche/address.js.map +1 -0
- package/dist/adapters/avalanche/api.d.ts +100 -0
- package/dist/adapters/avalanche/api.js +381 -0
- package/dist/adapters/avalanche/api.js.map +1 -0
- package/dist/adapters/avalanche/builder.d.ts +13 -0
- package/dist/adapters/avalanche/builder.js +336 -0
- package/dist/adapters/avalanche/builder.js.map +1 -0
- package/dist/adapters/avalanche/cb58.d.ts +7 -0
- package/dist/adapters/avalanche/cb58.js +49 -0
- package/dist/adapters/avalanche/cb58.js.map +1 -0
- package/dist/adapters/avalanche/chains.d.ts +21 -0
- package/dist/adapters/avalanche/chains.js +79 -0
- package/dist/adapters/avalanche/chains.js.map +1 -0
- package/dist/adapters/avalanche/codec.d.ts +94 -0
- package/dist/adapters/avalanche/codec.js +371 -0
- package/dist/adapters/avalanche/codec.js.map +1 -0
- package/dist/adapters/avalanche/context.d.ts +59 -0
- package/dist/adapters/avalanche/context.js +114 -0
- package/dist/adapters/avalanche/context.js.map +1 -0
- package/dist/adapters/avalanche/decode.d.ts +16 -0
- package/dist/adapters/avalanche/decode.js +101 -0
- package/dist/adapters/avalanche/decode.js.map +1 -0
- package/dist/adapters/avalanche/driver.d.ts +22 -0
- package/dist/adapters/avalanche/driver.js +81 -0
- package/dist/adapters/avalanche/driver.js.map +1 -0
- package/dist/adapters/avalanche/errors.d.ts +18 -0
- package/dist/adapters/avalanche/errors.js +61 -0
- package/dist/adapters/avalanche/errors.js.map +1 -0
- package/dist/adapters/avalanche/fees.d.ts +23 -0
- package/dist/adapters/avalanche/fees.js +105 -0
- package/dist/adapters/avalanche/fees.js.map +1 -0
- package/dist/adapters/avalanche/index.d.ts +19 -0
- package/dist/adapters/avalanche/index.js +8 -0
- package/dist/adapters/avalanche/index.js.map +1 -0
- package/dist/adapters/avalanche/network.d.ts +37 -0
- package/dist/adapters/avalanche/network.js +135 -0
- package/dist/adapters/avalanche/network.js.map +1 -0
- package/dist/adapters/avalanche/plugin.d.ts +21 -0
- package/dist/adapters/avalanche/plugin.js +46 -0
- package/dist/adapters/avalanche/plugin.js.map +1 -0
- package/dist/adapters/avalanche/presets.d.ts +6 -0
- package/dist/adapters/avalanche/presets.js +86 -0
- package/dist/adapters/avalanche/presets.js.map +1 -0
- package/dist/adapters/avalanche/proofs.d.ts +41 -0
- package/dist/adapters/avalanche/proofs.js +270 -0
- package/dist/adapters/avalanche/proofs.js.map +1 -0
- package/dist/adapters/avalanche/reader.d.ts +40 -0
- package/dist/adapters/avalanche/reader.js +231 -0
- package/dist/adapters/avalanche/reader.js.map +1 -0
- package/dist/adapters/avalanche/sdk.d.ts +182 -0
- package/dist/adapters/avalanche/sdk.js +21 -0
- package/dist/adapters/avalanche/sdk.js.map +1 -0
- package/dist/adapters/avalanche/types.d.ts +86 -0
- package/dist/{type/common.js → adapters/avalanche/types.js} +1 -1
- package/dist/adapters/avalanche/types.js.map +1 -0
- package/dist/adapters/evm/builder.d.ts +11 -0
- package/dist/adapters/evm/builder.js +326 -0
- package/dist/adapters/evm/builder.js.map +1 -0
- package/dist/adapters/evm/chains.d.ts +6 -0
- package/dist/adapters/evm/chains.js +203 -0
- package/dist/adapters/evm/chains.js.map +1 -0
- package/dist/adapters/evm/client.d.ts +84 -0
- package/dist/adapters/evm/client.js +335 -0
- package/dist/adapters/evm/client.js.map +1 -0
- package/dist/adapters/evm/decode.d.ts +35 -0
- package/dist/adapters/evm/decode.js +170 -0
- package/dist/adapters/evm/decode.js.map +1 -0
- package/dist/adapters/evm/driver.d.ts +8 -0
- package/dist/adapters/evm/driver.js +61 -0
- package/dist/adapters/evm/driver.js.map +1 -0
- package/dist/adapters/evm/errors.d.ts +20 -0
- package/dist/adapters/evm/errors.js +110 -0
- package/dist/adapters/evm/errors.js.map +1 -0
- package/dist/adapters/evm/ethers-client.d.ts +43 -0
- package/dist/adapters/evm/ethers-client.js +135 -0
- package/dist/adapters/evm/ethers-client.js.map +1 -0
- package/dist/adapters/evm/fees.d.ts +79 -0
- package/dist/adapters/evm/fees.js +234 -0
- package/dist/adapters/evm/fees.js.map +1 -0
- package/dist/adapters/evm/index.d.ts +20 -0
- package/dist/adapters/evm/index.js +11 -0
- package/dist/adapters/evm/index.js.map +1 -0
- package/dist/adapters/evm/network.d.ts +60 -0
- package/dist/adapters/evm/network.js +131 -0
- package/dist/adapters/evm/network.js.map +1 -0
- package/dist/adapters/evm/plugin.d.ts +36 -0
- package/dist/adapters/evm/plugin.js +102 -0
- package/dist/adapters/evm/plugin.js.map +1 -0
- package/dist/adapters/evm/presets.d.ts +2 -0
- package/dist/adapters/evm/presets.js +105 -0
- package/dist/adapters/evm/presets.js.map +1 -0
- package/dist/adapters/evm/proofs.d.ts +19 -0
- package/dist/adapters/evm/proofs.js +358 -0
- package/dist/adapters/evm/proofs.js.map +1 -0
- package/dist/adapters/evm/rawtx.d.ts +25 -0
- package/dist/adapters/evm/rawtx.js +176 -0
- package/dist/adapters/evm/rawtx.js.map +1 -0
- package/dist/adapters/evm/reader.d.ts +65 -0
- package/dist/adapters/evm/reader.js +292 -0
- package/dist/adapters/evm/reader.js.map +1 -0
- package/dist/adapters/evm/rpc.d.ts +39 -0
- package/dist/adapters/evm/rpc.js +152 -0
- package/dist/adapters/evm/rpc.js.map +1 -0
- package/dist/adapters/evm/tokens.d.ts +7 -0
- package/dist/adapters/evm/tokens.js +23 -0
- package/dist/adapters/evm/tokens.js.map +1 -0
- package/dist/adapters/evm/types.d.ts +255 -0
- package/dist/{type/account.js → adapters/evm/types.js} +1 -1
- package/dist/adapters/evm/types.js.map +1 -0
- package/dist/adapters/evm/web3-client.d.ts +23 -0
- package/dist/adapters/evm/web3-client.js +159 -0
- package/dist/adapters/evm/web3-client.js.map +1 -0
- package/dist/adapters/solana/builder.d.ts +18 -0
- package/dist/adapters/solana/builder.js +545 -0
- package/dist/adapters/solana/builder.js.map +1 -0
- package/dist/adapters/solana/chains.d.ts +13 -0
- package/dist/adapters/solana/chains.js +37 -0
- package/dist/adapters/solana/chains.js.map +1 -0
- package/dist/adapters/solana/decode.d.ts +111 -0
- package/dist/adapters/solana/decode.js +595 -0
- package/dist/adapters/solana/decode.js.map +1 -0
- package/dist/adapters/solana/driver.d.ts +15 -0
- package/dist/adapters/solana/driver.js +72 -0
- package/dist/adapters/solana/driver.js.map +1 -0
- package/dist/adapters/solana/errors.d.ts +36 -0
- package/dist/adapters/solana/errors.js +154 -0
- package/dist/adapters/solana/errors.js.map +1 -0
- package/dist/adapters/solana/fees.d.ts +68 -0
- package/dist/adapters/solana/fees.js +205 -0
- package/dist/adapters/solana/fees.js.map +1 -0
- package/dist/adapters/solana/heights.d.ts +47 -0
- package/dist/adapters/solana/heights.js +185 -0
- package/dist/adapters/solana/heights.js.map +1 -0
- package/dist/adapters/solana/history.d.ts +10 -0
- package/dist/adapters/solana/history.js +71 -0
- package/dist/adapters/solana/history.js.map +1 -0
- package/dist/adapters/solana/index.d.ts +16 -0
- package/dist/adapters/solana/index.js +9 -0
- package/dist/adapters/solana/index.js.map +1 -0
- package/dist/adapters/solana/keys.d.ts +13 -0
- package/dist/adapters/solana/keys.js +69 -0
- package/dist/adapters/solana/keys.js.map +1 -0
- package/dist/adapters/solana/network.d.ts +24 -0
- package/dist/adapters/solana/network.js +95 -0
- package/dist/adapters/solana/network.js.map +1 -0
- package/dist/adapters/solana/plugin.d.ts +18 -0
- package/dist/adapters/solana/plugin.js +41 -0
- package/dist/adapters/solana/plugin.js.map +1 -0
- package/dist/adapters/solana/presets.d.ts +2 -0
- package/dist/adapters/solana/presets.js +77 -0
- package/dist/adapters/solana/presets.js.map +1 -0
- package/dist/adapters/solana/programs.d.ts +44 -0
- package/dist/adapters/solana/programs.js +159 -0
- package/dist/adapters/solana/programs.js.map +1 -0
- package/dist/adapters/solana/proofs.d.ts +56 -0
- package/dist/adapters/solana/proofs.js +540 -0
- package/dist/adapters/solana/proofs.js.map +1 -0
- package/dist/adapters/solana/reader.d.ts +82 -0
- package/dist/adapters/solana/reader.js +326 -0
- package/dist/adapters/solana/reader.js.map +1 -0
- package/dist/adapters/solana/rpc.d.ts +102 -0
- package/dist/adapters/solana/rpc.js +301 -0
- package/dist/adapters/solana/rpc.js.map +1 -0
- package/dist/adapters/solana/tokens.d.ts +7 -0
- package/dist/adapters/solana/tokens.js +19 -0
- package/dist/adapters/solana/tokens.js.map +1 -0
- package/dist/adapters/solana/types.d.ts +121 -0
- package/dist/{type/contract.js → adapters/solana/types.js} +1 -1
- package/dist/adapters/solana/types.js.map +1 -0
- package/dist/adapters/solana/web3.d.ts +5 -0
- package/dist/adapters/solana/web3.js +83 -0
- package/dist/adapters/solana/web3.js.map +1 -0
- package/dist/adapters/solana/wire.d.ts +62 -0
- package/dist/adapters/solana/wire.js +168 -0
- package/dist/adapters/solana/wire.js.map +1 -0
- package/dist/adapters/ton/address.d.ts +43 -0
- package/dist/adapters/ton/address.js +168 -0
- package/dist/adapters/ton/address.js.map +1 -0
- package/dist/adapters/ton/api.d.ts +344 -0
- package/dist/adapters/ton/api.js +942 -0
- package/dist/adapters/ton/api.js.map +1 -0
- package/dist/adapters/ton/builder.d.ts +18 -0
- package/dist/adapters/ton/builder.js +701 -0
- package/dist/adapters/ton/builder.js.map +1 -0
- package/dist/adapters/ton/chains.d.ts +16 -0
- package/dist/adapters/ton/chains.js +39 -0
- package/dist/adapters/ton/chains.js.map +1 -0
- package/dist/adapters/ton/decode.d.ts +43 -0
- package/dist/adapters/ton/decode.js +219 -0
- package/dist/adapters/ton/decode.js.map +1 -0
- package/dist/adapters/ton/driver.d.ts +10 -0
- package/dist/adapters/ton/driver.js +117 -0
- package/dist/adapters/ton/driver.js.map +1 -0
- package/dist/adapters/ton/errors.d.ts +36 -0
- package/dist/adapters/ton/errors.js +89 -0
- package/dist/adapters/ton/errors.js.map +1 -0
- package/dist/adapters/ton/fees.d.ts +28 -0
- package/dist/adapters/ton/fees.js +121 -0
- package/dist/adapters/ton/fees.js.map +1 -0
- package/dist/adapters/ton/index.d.ts +16 -0
- package/dist/adapters/ton/index.js +9 -0
- package/dist/adapters/ton/index.js.map +1 -0
- package/dist/adapters/ton/messages.d.ts +157 -0
- package/dist/adapters/ton/messages.js +397 -0
- package/dist/adapters/ton/messages.js.map +1 -0
- package/dist/adapters/ton/native-client.d.ts +10 -0
- package/dist/adapters/ton/native-client.js +47 -0
- package/dist/adapters/ton/native-client.js.map +1 -0
- package/dist/adapters/ton/network.d.ts +58 -0
- package/dist/adapters/ton/network.js +207 -0
- package/dist/adapters/ton/network.js.map +1 -0
- package/dist/adapters/ton/plugin.d.ts +24 -0
- package/dist/adapters/ton/plugin.js +57 -0
- package/dist/adapters/ton/plugin.js.map +1 -0
- package/dist/adapters/ton/presets.d.ts +6 -0
- package/dist/adapters/ton/presets.js +94 -0
- package/dist/adapters/ton/presets.js.map +1 -0
- package/dist/adapters/ton/proofs.d.ts +66 -0
- package/dist/adapters/ton/proofs.js +813 -0
- package/dist/adapters/ton/proofs.js.map +1 -0
- package/dist/adapters/ton/reader.d.ts +194 -0
- package/dist/adapters/ton/reader.js +781 -0
- package/dist/adapters/ton/reader.js.map +1 -0
- package/dist/adapters/ton/tokens.d.ts +10 -0
- package/dist/adapters/ton/tokens.js +27 -0
- package/dist/adapters/ton/tokens.js.map +1 -0
- package/dist/adapters/ton/trace.d.ts +48 -0
- package/dist/adapters/ton/trace.js +277 -0
- package/dist/adapters/ton/trace.js.map +1 -0
- package/dist/adapters/ton/types.d.ts +105 -0
- package/dist/{type/transact.js → adapters/ton/types.js} +1 -1
- package/dist/adapters/ton/types.js.map +1 -0
- package/dist/adapters/ton/wallets.d.ts +86 -0
- package/dist/adapters/ton/wallets.js +373 -0
- package/dist/adapters/ton/wallets.js.map +1 -0
- package/dist/adapters/tron/abi.d.ts +39 -0
- package/dist/adapters/tron/abi.js +110 -0
- package/dist/adapters/tron/abi.js.map +1 -0
- package/dist/adapters/tron/address.d.ts +20 -0
- package/dist/adapters/tron/address.js +110 -0
- package/dist/adapters/tron/address.js.map +1 -0
- package/dist/adapters/tron/builder.d.ts +12 -0
- package/dist/adapters/tron/builder.js +553 -0
- package/dist/adapters/tron/builder.js.map +1 -0
- package/dist/adapters/tron/chains.d.ts +12 -0
- package/dist/adapters/tron/chains.js +35 -0
- package/dist/adapters/tron/chains.js.map +1 -0
- package/dist/adapters/tron/codec.d.ts +10 -0
- package/dist/adapters/tron/codec.js +322 -0
- package/dist/adapters/tron/codec.js.map +1 -0
- package/dist/adapters/tron/decode.d.ts +50 -0
- package/dist/adapters/tron/decode.js +280 -0
- package/dist/adapters/tron/decode.js.map +1 -0
- package/dist/adapters/tron/driver.d.ts +12 -0
- package/dist/adapters/tron/driver.js +106 -0
- package/dist/adapters/tron/driver.js.map +1 -0
- package/dist/adapters/tron/errors.d.ts +74 -0
- package/dist/adapters/tron/errors.js +261 -0
- package/dist/adapters/tron/errors.js.map +1 -0
- package/dist/adapters/tron/fees.d.ts +49 -0
- package/dist/adapters/tron/fees.js +166 -0
- package/dist/adapters/tron/fees.js.map +1 -0
- package/dist/adapters/tron/http.d.ts +173 -0
- package/dist/adapters/tron/http.js +729 -0
- package/dist/adapters/tron/http.js.map +1 -0
- package/dist/adapters/tron/index.d.ts +16 -0
- package/dist/adapters/tron/index.js +15 -0
- package/dist/adapters/tron/index.js.map +1 -0
- package/dist/adapters/tron/network.d.ts +44 -0
- package/dist/adapters/tron/network.js +163 -0
- package/dist/adapters/tron/network.js.map +1 -0
- package/dist/adapters/tron/plugin.d.ts +17 -0
- package/dist/adapters/tron/plugin.js +39 -0
- package/dist/adapters/tron/plugin.js.map +1 -0
- package/dist/adapters/tron/presets.d.ts +5 -0
- package/dist/adapters/tron/presets.js +68 -0
- package/dist/adapters/tron/presets.js.map +1 -0
- package/dist/adapters/tron/proofs.d.ts +80 -0
- package/dist/adapters/tron/proofs.js +370 -0
- package/dist/adapters/tron/proofs.js.map +1 -0
- package/dist/adapters/tron/protobuf.d.ts +36 -0
- package/dist/adapters/tron/protobuf.js +90 -0
- package/dist/adapters/tron/protobuf.js.map +1 -0
- package/dist/adapters/tron/reader.d.ts +47 -0
- package/dist/adapters/tron/reader.js +203 -0
- package/dist/adapters/tron/reader.js.map +1 -0
- package/dist/adapters/tron/tokens.d.ts +7 -0
- package/dist/adapters/tron/tokens.js +14 -0
- package/dist/adapters/tron/tokens.js.map +1 -0
- package/dist/adapters/tron/types.d.ts +166 -0
- package/dist/adapters/tron/types.js +3 -0
- package/dist/adapters/tron/types.js.map +1 -0
- package/dist/adapters/utxo/address.d.ts +51 -0
- package/dist/adapters/utxo/address.js +341 -0
- package/dist/adapters/utxo/address.js.map +1 -0
- package/dist/adapters/utxo/builder.d.ts +35 -0
- package/dist/adapters/utxo/builder.js +380 -0
- package/dist/adapters/utxo/builder.js.map +1 -0
- package/dist/adapters/utxo/chains.d.ts +17 -0
- package/dist/adapters/utxo/chains.js +99 -0
- package/dist/adapters/utxo/chains.js.map +1 -0
- package/dist/adapters/utxo/codec.d.ts +120 -0
- package/dist/adapters/utxo/codec.js +408 -0
- package/dist/adapters/utxo/codec.js.map +1 -0
- package/dist/adapters/utxo/coinselect.d.ts +48 -0
- package/dist/adapters/utxo/coinselect.js +131 -0
- package/dist/adapters/utxo/coinselect.js.map +1 -0
- package/dist/adapters/utxo/context.d.ts +57 -0
- package/dist/adapters/utxo/context.js +118 -0
- package/dist/adapters/utxo/context.js.map +1 -0
- package/dist/adapters/utxo/decode.d.ts +14 -0
- package/dist/adapters/utxo/decode.js +85 -0
- package/dist/adapters/utxo/decode.js.map +1 -0
- package/dist/adapters/utxo/driver.d.ts +16 -0
- package/dist/adapters/utxo/driver.js +74 -0
- package/dist/adapters/utxo/driver.js.map +1 -0
- package/dist/adapters/utxo/ecc.d.ts +9 -0
- package/dist/adapters/utxo/ecc.js +26 -0
- package/dist/adapters/utxo/ecc.js.map +1 -0
- package/dist/adapters/utxo/errors.d.ts +52 -0
- package/dist/adapters/utxo/errors.js +191 -0
- package/dist/adapters/utxo/errors.js.map +1 -0
- package/dist/adapters/utxo/esplora.d.ts +79 -0
- package/dist/adapters/utxo/esplora.js +451 -0
- package/dist/adapters/utxo/esplora.js.map +1 -0
- package/dist/adapters/utxo/fees.d.ts +41 -0
- package/dist/adapters/utxo/fees.js +125 -0
- package/dist/adapters/utxo/fees.js.map +1 -0
- package/dist/adapters/utxo/index.d.ts +17 -0
- package/dist/adapters/utxo/index.js +8 -0
- package/dist/adapters/utxo/index.js.map +1 -0
- package/dist/adapters/utxo/network.d.ts +50 -0
- package/dist/adapters/utxo/network.js +165 -0
- package/dist/adapters/utxo/network.js.map +1 -0
- package/dist/adapters/utxo/plugin.d.ts +17 -0
- package/dist/adapters/utxo/plugin.js +41 -0
- package/dist/adapters/utxo/plugin.js.map +1 -0
- package/dist/adapters/utxo/presets.d.ts +12 -0
- package/dist/adapters/utxo/presets.js +47 -0
- package/dist/adapters/utxo/presets.js.map +1 -0
- package/dist/adapters/utxo/preview.d.ts +3 -0
- package/dist/adapters/utxo/preview.js +65 -0
- package/dist/adapters/utxo/preview.js.map +1 -0
- package/dist/adapters/utxo/proofs.d.ts +57 -0
- package/dist/adapters/utxo/proofs.js +331 -0
- package/dist/adapters/utxo/proofs.js.map +1 -0
- package/dist/adapters/utxo/rawtx.d.ts +59 -0
- package/dist/adapters/utxo/rawtx.js +234 -0
- package/dist/adapters/utxo/rawtx.js.map +1 -0
- package/dist/adapters/utxo/reader.d.ts +36 -0
- package/dist/adapters/utxo/reader.js +265 -0
- package/dist/adapters/utxo/reader.js.map +1 -0
- package/dist/adapters/utxo/sdk.d.ts +18 -0
- package/dist/adapters/utxo/sdk.js +17 -0
- package/dist/adapters/utxo/sdk.js.map +1 -0
- package/dist/adapters/utxo/signed-psbt.d.ts +36 -0
- package/dist/adapters/utxo/signed-psbt.js +428 -0
- package/dist/adapters/utxo/signed-psbt.js.map +1 -0
- package/dist/adapters/utxo/spend.d.ts +59 -0
- package/dist/adapters/utxo/spend.js +230 -0
- package/dist/adapters/utxo/spend.js.map +1 -0
- package/dist/adapters/utxo/types.d.ts +167 -0
- package/dist/adapters/utxo/types.js +3 -0
- package/dist/adapters/utxo/types.js.map +1 -0
- package/dist/core/assets/service.d.ts +18 -0
- package/dist/core/assets/service.js +69 -0
- package/dist/core/assets/service.js.map +1 -0
- package/dist/core/blockchain/default-ref.d.ts +4 -0
- package/dist/core/blockchain/default-ref.js +16 -0
- package/dist/core/blockchain/default-ref.js.map +1 -0
- package/dist/core/blockchain/handle.d.ts +200 -0
- package/dist/core/blockchain/handle.js +579 -0
- package/dist/core/blockchain/handle.js.map +1 -0
- package/dist/core/blockchain/internal.d.ts +19 -0
- package/dist/core/blockchain/internal.js +16 -0
- package/dist/core/blockchain/internal.js.map +1 -0
- package/dist/core/blockchain/mapping.d.ts +22 -0
- package/dist/core/blockchain/mapping.js +136 -0
- package/dist/core/blockchain/mapping.js.map +1 -0
- package/dist/core/config/env.d.ts +8 -0
- package/dist/core/config/env.js +60 -0
- package/dist/core/config/env.js.map +1 -0
- package/dist/core/config/merge.d.ts +26 -0
- package/dist/core/config/merge.js +144 -0
- package/dist/core/config/merge.js.map +1 -0
- package/dist/core/config/resolve.d.ts +12 -0
- package/dist/core/config/resolve.js +251 -0
- package/dist/core/config/resolve.js.map +1 -0
- package/dist/core/config/types.d.ts +165 -0
- package/dist/core/config/types.js +3 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/container/builtins.d.ts +4 -0
- package/dist/core/container/builtins.js +13 -0
- package/dist/core/container/builtins.js.map +1 -0
- package/dist/core/container/container.d.ts +69 -0
- package/dist/core/container/container.js +466 -0
- package/dist/core/container/container.js.map +1 -0
- package/dist/core/container/default.d.ts +15 -0
- package/dist/core/container/default.js +70 -0
- package/dist/core/container/default.js.map +1 -0
- package/dist/core/container/internals.d.ts +54 -0
- package/dist/core/container/internals.js +21 -0
- package/dist/core/container/internals.js.map +1 -0
- package/dist/core/container/pool.d.ts +27 -0
- package/dist/core/container/pool.js +77 -0
- package/dist/core/container/pool.js.map +1 -0
- package/dist/core/driver/types.d.ts +346 -0
- package/dist/core/driver/types.js +3 -0
- package/dist/core/driver/types.js.map +1 -0
- package/dist/core/errors/codes.d.ts +153 -0
- package/dist/core/errors/codes.js +49 -0
- package/dist/core/errors/codes.js.map +1 -0
- package/dist/core/errors/error.d.ts +66 -0
- package/dist/core/errors/error.js +129 -0
- package/dist/core/errors/error.js.map +1 -0
- package/dist/core/events/bus.d.ts +12 -0
- package/dist/core/events/bus.js +46 -0
- package/dist/core/events/bus.js.map +1 -0
- package/dist/core/events/logger.d.ts +13 -0
- package/dist/core/events/logger.js +42 -0
- package/dist/core/events/logger.js.map +1 -0
- package/dist/core/events/types.d.ts +131 -0
- package/dist/core/events/types.js +3 -0
- package/dist/core/events/types.js.map +1 -0
- package/dist/core/lifecycle/engine-rules.d.ts +107 -0
- package/dist/core/lifecycle/engine-rules.js +257 -0
- package/dist/core/lifecycle/engine-rules.js.map +1 -0
- package/dist/core/lifecycle/engine.d.ts +500 -0
- package/dist/core/lifecycle/engine.js +1732 -0
- package/dist/core/lifecycle/engine.js.map +1 -0
- package/dist/core/lifecycle/evaluate.d.ts +19 -0
- package/dist/core/lifecycle/evaluate.js +72 -0
- package/dist/core/lifecycle/evaluate.js.map +1 -0
- package/dist/core/lifecycle/intent.d.ts +11 -0
- package/dist/core/lifecycle/intent.js +88 -0
- package/dist/core/lifecycle/intent.js.map +1 -0
- package/dist/core/lifecycle/monitor.d.ts +138 -0
- package/dist/core/lifecycle/monitor.js +606 -0
- package/dist/core/lifecycle/monitor.js.map +1 -0
- package/dist/core/lifecycle/observations.d.ts +17 -0
- package/dist/core/lifecycle/observations.js +59 -0
- package/dist/core/lifecycle/observations.js.map +1 -0
- package/dist/core/lifecycle/reconcile.d.ts +58 -0
- package/dist/core/lifecycle/reconcile.js +112 -0
- package/dist/core/lifecycle/reconcile.js.map +1 -0
- package/dist/core/lifecycle/views.d.ts +49 -0
- package/dist/core/lifecycle/views.js +57 -0
- package/dist/core/lifecycle/views.js.map +1 -0
- package/dist/core/lifecycle/workers.d.ts +82 -0
- package/dist/core/lifecycle/workers.js +329 -0
- package/dist/core/lifecycle/workers.js.map +1 -0
- package/dist/core/model/address.d.ts +32 -0
- package/dist/core/model/address.js +43 -0
- package/dist/core/model/address.js.map +1 -0
- package/dist/core/model/amount.d.ts +25 -0
- package/dist/core/model/amount.js +102 -0
- package/dist/core/model/amount.js.map +1 -0
- package/dist/core/model/asset.d.ts +28 -0
- package/dist/core/model/asset.js +47 -0
- package/dist/core/model/asset.js.map +1 -0
- package/dist/core/model/capability.d.ts +3 -0
- package/dist/core/model/capability.js +18 -0
- package/dist/core/model/capability.js.map +1 -0
- package/dist/core/model/chain.d.ts +63 -0
- package/dist/core/model/chain.js +8 -0
- package/dist/core/model/chain.js.map +1 -0
- package/dist/core/model/fee.d.ts +36 -0
- package/dist/core/model/fee.js +17 -0
- package/dist/core/model/fee.js.map +1 -0
- package/dist/core/model/ids.d.ts +37 -0
- package/dist/core/model/ids.js +13 -0
- package/dist/core/model/ids.js.map +1 -0
- package/dist/core/model/intent.d.ts +63 -0
- package/dist/core/model/intent.js +81 -0
- package/dist/core/model/intent.js.map +1 -0
- package/dist/core/model/ordering.d.ts +20 -0
- package/dist/core/model/ordering.js +29 -0
- package/dist/core/model/ordering.js.map +1 -0
- package/dist/core/model/transaction.d.ts +116 -0
- package/dist/{type/lib-types.js → core/model/transaction.js} +1 -1
- package/dist/core/model/transaction.js.map +1 -0
- package/dist/core/observe/scanner.d.ts +135 -0
- package/dist/core/observe/scanner.js +355 -0
- package/dist/core/observe/scanner.js.map +1 -0
- package/dist/core/ordering/reservations.d.ts +16 -0
- package/dist/core/ordering/reservations.js +53 -0
- package/dist/core/ordering/reservations.js.map +1 -0
- package/dist/core/ordering/sequence.d.ts +61 -0
- package/dist/core/ordering/sequence.js +155 -0
- package/dist/core/ordering/sequence.js.map +1 -0
- package/dist/core/registry/adapters.d.ts +10 -0
- package/dist/core/registry/adapters.js +56 -0
- package/dist/core/registry/adapters.js.map +1 -0
- package/dist/core/registry/assets.d.ts +18 -0
- package/dist/core/registry/assets.js +90 -0
- package/dist/core/registry/assets.js.map +1 -0
- package/dist/core/registry/chains.d.ts +10 -0
- package/dist/core/registry/chains.js +80 -0
- package/dist/core/registry/chains.js.map +1 -0
- package/dist/core/registry/plugin.d.ts +41 -0
- package/dist/core/registry/plugin.js +109 -0
- package/dist/core/registry/plugin.js.map +1 -0
- package/dist/core/registry/providers.d.ts +31 -0
- package/dist/core/registry/providers.js +43 -0
- package/dist/core/registry/providers.js.map +1 -0
- package/dist/core/registry/schemes.d.ts +30 -0
- package/dist/core/registry/schemes.js +84 -0
- package/dist/core/registry/schemes.js.map +1 -0
- package/dist/core/secret/fragments.d.ts +33 -0
- package/dist/core/secret/fragments.js +110 -0
- package/dist/core/secret/fragments.js.map +1 -0
- package/dist/core/secret/redact.d.ts +10 -0
- package/dist/core/secret/redact.js +110 -0
- package/dist/core/secret/redact.js.map +1 -0
- package/dist/core/secret/secret.d.ts +14 -0
- package/dist/core/secret/secret.js +42 -0
- package/dist/core/secret/secret.js.map +1 -0
- package/dist/core/signing/callback.d.ts +10 -0
- package/dist/core/signing/callback.js +22 -0
- package/dist/core/signing/callback.js.map +1 -0
- package/dist/core/signing/guard.d.ts +18 -0
- package/dist/core/signing/guard.js +72 -0
- package/dist/core/signing/guard.js.map +1 -0
- package/dist/core/signing/hd.d.ts +36 -0
- package/dist/core/signing/hd.js +167 -0
- package/dist/core/signing/hd.js.map +1 -0
- package/dist/core/signing/local.d.ts +48 -0
- package/dist/core/signing/local.js +190 -0
- package/dist/core/signing/local.js.map +1 -0
- package/dist/core/signing/orchestrator.d.ts +40 -0
- package/dist/core/signing/orchestrator.js +300 -0
- package/dist/core/signing/orchestrator.js.map +1 -0
- package/dist/core/signing/types.d.ts +64 -0
- package/dist/core/signing/types.js +3 -0
- package/dist/core/signing/types.js.map +1 -0
- package/dist/core/signing/wallet.d.ts +48 -0
- package/dist/core/signing/wallet.js +153 -0
- package/dist/core/signing/wallet.js.map +1 -0
- package/dist/core/store/clone.d.ts +25 -0
- package/dist/core/store/clone.js +71 -0
- package/dist/core/store/clone.js.map +1 -0
- package/dist/core/store/memory.d.ts +38 -0
- package/dist/core/store/memory.js +325 -0
- package/dist/core/store/memory.js.map +1 -0
- package/dist/core/store/types.d.ts +246 -0
- package/dist/core/store/types.js +117 -0
- package/dist/core/store/types.js.map +1 -0
- package/dist/core/transport/backoff.d.ts +8 -0
- package/dist/core/transport/backoff.js +27 -0
- package/dist/core/transport/backoff.js.map +1 -0
- package/dist/core/transport/circuit.d.ts +25 -0
- package/dist/core/transport/circuit.js +61 -0
- package/dist/core/transport/circuit.js.map +1 -0
- package/dist/core/transport/http-transport.d.ts +30 -0
- package/dist/core/transport/http-transport.js +1695 -0
- package/dist/core/transport/http-transport.js.map +1 -0
- package/dist/core/transport/rate-limit.d.ts +27 -0
- package/dist/core/transport/rate-limit.js +78 -0
- package/dist/core/transport/rate-limit.js.map +1 -0
- package/dist/core/transport/stale-view.d.ts +11 -0
- package/dist/core/transport/stale-view.js +17 -0
- package/dist/core/transport/stale-view.js.map +1 -0
- package/dist/core/transport/types.d.ts +144 -0
- package/dist/core/transport/types.js +6 -0
- package/dist/core/transport/types.js.map +1 -0
- package/dist/core/util/bytes.d.ts +9 -0
- package/dist/core/util/bytes.js +40 -0
- package/dist/core/util/bytes.js.map +1 -0
- package/dist/core/util/clock.d.ts +6 -0
- package/dist/core/util/clock.js +26 -0
- package/dist/core/util/clock.js.map +1 -0
- package/dist/core/util/freeze.d.ts +8 -0
- package/dist/core/util/freeze.js +31 -0
- package/dist/core/util/freeze.js.map +1 -0
- package/dist/core/util/json.d.ts +29 -0
- package/dist/core/util/json.js +165 -0
- package/dist/core/util/json.js.map +1 -0
- package/dist/core/util/names.d.ts +21 -0
- package/dist/core/util/names.js +46 -0
- package/dist/core/util/names.js.map +1 -0
- package/dist/index.d.ts +64 -14
- package/dist/index.js +105 -49
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +21 -0
- package/dist/native.js +44 -0
- package/dist/native.js.map +1 -0
- package/dist/testing/contracts/api.d.ts +12 -0
- package/dist/testing/contracts/api.js +58 -0
- package/dist/testing/contracts/api.js.map +1 -0
- package/dist/testing/contracts/cursors.d.ts +6 -0
- package/dist/testing/contracts/cursors.js +43 -0
- package/dist/testing/contracts/cursors.js.map +1 -0
- package/dist/testing/contracts/locks.d.ts +10 -0
- package/dist/testing/contracts/locks.js +63 -0
- package/dist/testing/contracts/locks.js.map +1 -0
- package/dist/testing/contracts/operations.d.ts +21 -0
- package/dist/testing/contracts/operations.js +718 -0
- package/dist/testing/contracts/operations.js.map +1 -0
- package/dist/testing/contracts/sequences.d.ts +6 -0
- package/dist/testing/contracts/sequences.js +68 -0
- package/dist/testing/contracts/sequences.js.map +1 -0
- package/dist/testing/env.d.ts +63 -0
- package/dist/testing/env.js +105 -0
- package/dist/testing/env.js.map +1 -0
- package/dist/testing/fake-chain.d.ts +118 -0
- package/dist/testing/fake-chain.js +536 -0
- package/dist/testing/fake-chain.js.map +1 -0
- package/dist/testing/fake-clock.d.ts +15 -0
- package/dist/testing/fake-clock.js +86 -0
- package/dist/testing/fake-clock.js.map +1 -0
- package/dist/testing/fake-driver.d.ts +15 -0
- package/dist/testing/fake-driver.js +458 -0
- package/dist/testing/fake-driver.js.map +1 -0
- package/dist/testing/fake-fetch.d.ts +32 -0
- package/dist/testing/fake-fetch.js +81 -0
- package/dist/testing/fake-fetch.js.map +1 -0
- package/dist/testing/fake-plugin.d.ts +30 -0
- package/dist/testing/fake-plugin.js +66 -0
- package/dist/testing/fake-plugin.js.map +1 -0
- package/dist/testing/faulty-store.d.ts +36 -0
- package/dist/testing/faulty-store.js +66 -0
- package/dist/testing/faulty-store.js.map +1 -0
- package/dist/testing/generation.d.ts +60 -0
- package/dist/testing/generation.js +252 -0
- package/dist/testing/generation.js.map +1 -0
- package/dist/testing/index.d.ts +28 -0
- package/dist/testing/index.js +51 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +188 -45
- package/dist/libs/eth/account.d.ts +0 -9
- package/dist/libs/eth/account.js +0 -58
- package/dist/libs/eth/account.js.map +0 -1
- package/dist/libs/eth/contract.d.ts +0 -7
- package/dist/libs/eth/contract.js +0 -42
- package/dist/libs/eth/contract.js.map +0 -1
- package/dist/libs/eth/index.d.ts +0 -24
- package/dist/libs/eth/index.js +0 -72
- package/dist/libs/eth/index.js.map +0 -1
- package/dist/libs/eth/transact.d.ts +0 -7
- package/dist/libs/eth/transact.js +0 -26
- package/dist/libs/eth/transact.js.map +0 -1
- package/dist/libs/index.d.ts +0 -2
- package/dist/libs/index.js +0 -19
- package/dist/libs/index.js.map +0 -1
- package/dist/libs/trx/account.d.ts +0 -9
- package/dist/libs/trx/account.js +0 -55
- package/dist/libs/trx/account.js.map +0 -1
- package/dist/libs/trx/contract.d.ts +0 -7
- package/dist/libs/trx/contract.js +0 -27
- package/dist/libs/trx/contract.js.map +0 -1
- package/dist/libs/trx/index.d.ts +0 -22
- package/dist/libs/trx/index.js +0 -64
- package/dist/libs/trx/index.js.map +0 -1
- package/dist/libs/trx/transact.d.ts +0 -7
- package/dist/libs/trx/transact.js +0 -26
- package/dist/libs/trx/transact.js.map +0 -1
- package/dist/tool/common.d.ts +0 -28
- package/dist/tool/common.js +0 -33
- package/dist/tool/common.js.map +0 -1
- package/dist/tool/eth-tools.d.ts +0 -3
- package/dist/tool/eth-tools.js +0 -33
- package/dist/tool/eth-tools.js.map +0 -1
- package/dist/tool/index.d.ts +0 -5
- package/dist/tool/index.js +0 -22
- package/dist/tool/index.js.map +0 -1
- package/dist/tool/logging.d.ts +0 -3
- package/dist/tool/logging.js +0 -11
- package/dist/tool/logging.js.map +0 -1
- package/dist/tool/options.d.ts +0 -6
- package/dist/tool/options.js +0 -41
- package/dist/tool/options.js.map +0 -1
- package/dist/tool/trx-tools.d.ts +0 -3
- package/dist/tool/trx-tools.js +0 -20
- package/dist/tool/trx-tools.js.map +0 -1
- package/dist/type/account.d.ts +0 -9
- package/dist/type/account.js.map +0 -1
- package/dist/type/common.d.ts +0 -18
- package/dist/type/common.js.map +0 -1
- package/dist/type/contract.d.ts +0 -10
- package/dist/type/contract.js.map +0 -1
- package/dist/type/index.d.ts +0 -5
- package/dist/type/index.js +0 -22
- package/dist/type/index.js.map +0 -1
- package/dist/type/lib-types.d.ts +0 -9
- package/dist/type/lib-types.js.map +0 -1
- package/dist/type/transact.d.ts +0 -7
- package/dist/type/transact.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../../src/adapters/solana/decode.ts"],"names":[],"mappings":";;;AAgRA,4CAuEC;AA0JD,8CA6EC;AAeD,0BA2CC;AAgED,oDAmBC;AA1rBD,+CAAqD;AACrD,yCASoB;AACpB,+BAAmF;AAInF,wFAAwF;AACxF,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,sFAAsF;AACtF,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B;;;GAGG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,+BAAoB,GAAG,CAAC,CAAC,CAAC;AACpE;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,MAAM,CAAC,iCAAsB,GAAG,KAAM,CAAC,CAAC;AACvE,yFAAyF;AACzF,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,uFAAuF;AACvF,MAAM,aAAa,GAAG,0BAA0B,CAAC;AAEjD,MAAM,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KAAK,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,CAC3D,CAAC;IACF,4DAA4D;IAC5D,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAA,YAAM,EAAC,+BAA+B,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QAC5C,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,IAAA,kBAAY,EAAC,4DAA4D,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,EAAE,CAAC,aAAa,KAAK,QAAQ;QAAE,MAAM,IAAA,YAAM,EAAC,oBAAoB,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;AAChD,CAAC","sourcesContent":["/**\n * Transaction decoding: `jsonParsed` transactions, inner instructions\n * included, into `DriverTransaction`s. Decoded transfers are checked against the pre/post\n * lamport and token balances, per account and per mint; any movement they do not explain\n * makes the transaction `decoding: 'partial'`. Locators are `ix:<outer>` and\n * `ix:<outer>.<inner>`.\n *\n * `parseTransaction` validates an answer once. A missing or ill-typed field is a retryable\n * `PROVIDER_UNAVAILABLE`, never a default: a truncated or drifted\n * answer never becomes a success or a failure. Every list and text is held to the format's\n * own bound, and account lookups go through one index, so the work stays\n * linear. Nothing here decodes bytes: unparsed instruction data and logs are never read.\n *\n * General decoding reports execution as the chain does. The phantom-success guard\n * (`tokenTransfersLanded`) is applied only on verdict paths.\n */\nimport type { DriverTransaction, DriverTransfer } from '../../core/driver/types';\nimport { canonicalJson } from '../../core/util/json';\nimport {\n MAX_COMPUTE_UNIT_LIMIT,\n MAX_TRANSACTION_SIZE,\n MEMO_PROGRAM,\n MEMO_V1_PROGRAM,\n SYSTEM_PROGRAM,\n TOKEN_2022_PROGRAM,\n TOKEN_PROGRAM,\n VOTE_PROGRAM,\n} from './programs';\nimport { amountString, inconsistent, malformed, notYet, record, u64 } from './rpc';\n\ntype Json = Record<string, unknown>;\n\n/** Account indexes are u8: no transaction names more accounts, loaded ones included. */\nconst MAX_ACCOUNT_KEYS = 256;\n/** The longest base58 text of an address (32 bytes) and of a signature (64 bytes). */\nconst MAX_ADDRESS_CHARS = 44;\nconst MAX_SIGNATURE_CHARS = 88;\n/**\n * Every outer instruction takes at least 3 bytes of the packet (its program index and its\n * account and data lengths).\n */\nconst MAX_OUTER_INSTRUCTIONS = Math.floor(MAX_TRANSACTION_SIZE / 3);\n/**\n * A generous bound on one instruction's inner instructions that keeps old blocks readable:\n * every CPI costs at least 1,000 compute units, and no instruction ever ran on more than\n * 1.4 M. (Today's runtime also caps a transaction's whole trace at 64.)\n */\nconst MAX_INNER_INSTRUCTIONS = Number(MAX_COMPUTE_UNIT_LIMIT / 1_000n);\n/** A CPI's instruction data is at most 10 KiB (agave `MAX_CPI_INSTRUCTION_DATA_LEN`). */\nconst MAX_CPI_INSTRUCTION_DATA = 10_240;\n/**\n * A real `TransactionError` nests three levels (`{\"InstructionError\":[0,{\"Custom\":1}]}`)\n * and holds a few short values: anything far larger is not one.\n */\nconst MAX_ERROR_DEPTH = 6;\nconst MAX_ERROR_VALUES = 64;\nconst MAX_ERROR_TEXT = 256;\n/** A `TransactionError` variant name, such as `AccountInUse` or `InstructionError`. */\nconst ERROR_VARIANT = /^[A-Z][A-Za-z0-9]{0,63}$/;\n\nconst TOKEN_PROGRAMS: readonly string[] = [TOKEN_PROGRAM, TOKEN_2022_PROGRAM];\n\nconst absent = (value: unknown): value is null | undefined =>\n value === undefined || value === null;\n\nconst text = (value: unknown, max: number): value is string =>\n typeof value === 'string' && value.length > 0 && value.length <= max;\n\nfunction address(value: unknown, what: string): string {\n if (!text(value, MAX_ADDRESS_CHARS)) throw malformed(what);\n return value;\n}\n\nconst optionalAddress = (value: unknown, what: string): string | undefined =>\n absent(value) ? undefined : address(value, what);\n\ninterface Instruction {\n readonly locator: string;\n readonly inner: boolean;\n readonly programId: string;\n readonly type?: string;\n readonly info: Json | null;\n readonly parsedText?: string;\n /** A parsed text (an inner memo) too long for any CPI to carry: not kept. */\n readonly textTooLong?: true;\n}\n\ninterface TokenBalance {\n readonly mint: string;\n readonly owner?: string;\n /** The program that owns the token account (classic or Token-2022), when reported. */\n readonly programId?: string;\n readonly amount: bigint;\n}\n\n/** A parsed transaction's facts, validated once. */\nexport interface ParsedTransaction {\n /** The first signature: the transaction's id. */\n readonly signature: string;\n readonly keys: readonly string[];\n /** Each account key's position (keys are unique). */\n readonly accountIndex: ReadonlyMap<string, number>;\n /** `null`, or the node's `TransactionError` (a string or a small object). */\n readonly err: unknown;\n readonly fee: bigint;\n readonly preBalances: readonly bigint[];\n readonly postBalances: readonly bigint[];\n readonly preTokens: ReadonlyMap<number, TokenBalance>;\n readonly postTokens: ReadonlyMap<number, TokenBalance>;\n /** Whether the node reported token balances at all (both lists present). */\n readonly tokenBalances: 'present' | 'absent';\n /** Whether the node recorded inner instructions at all. */\n readonly innerInstructions: 'present' | 'absent';\n /** In execution order: each outer instruction, then its inner ones. */\n readonly instructions: readonly Instruction[];\n readonly version: 'legacy' | number;\n readonly slot?: bigint;\n readonly blockTime?: number;\n}\n\n/** Whether a node's JSON value stays within `depth` levels and the shared `budget`. */\nfunction bounded(value: unknown, depth: number, budget: { left: number }): boolean {\n if (--budget.left < 0) return false;\n switch (typeof value) {\n case 'number':\n case 'bigint':\n case 'boolean':\n return true;\n case 'string':\n return value.length <= MAX_ERROR_TEXT;\n case 'object': {\n if (value === null) return true;\n if (depth === 0) return false;\n const children: unknown[] = Array.isArray(value) ? value : Object.values(value);\n return children.every((child) => bounded(child, depth - 1, budget));\n }\n default:\n return false;\n }\n}\n\n/**\n * `meta.err`: required; `null`, or a `TransactionError`: a unit variant's name\n * (`\"AccountInUse\"`), or an object with exactly one variant name as its key and a small\n * value (`{\"InstructionError\":[0,{\"Custom\":1}]}`). A drifted `{}` or free text is malformed.\n */\nfunction executionError(value: unknown): unknown {\n if (value === null) return null;\n const object = record(value);\n const [variant, ...others] = object ? Object.keys(object) : [];\n const valid =\n typeof value === 'string'\n ? ERROR_VARIANT.test(value)\n : variant !== undefined &&\n others.length === 0 &&\n ERROR_VARIANT.test(variant) &&\n bounded(value, MAX_ERROR_DEPTH, { left: MAX_ERROR_VALUES });\n if (!valid) throw malformed('transaction status');\n return value;\n}\n\n/**\n * The deprecated `meta.status` (`{\"Ok\":null}` or `{\"Err\":…}`) may be left out; when a node\n * reports it, it must say what `meta.err` says, or the answer drifted.\n */\nfunction checkStatus(status: unknown, err: unknown): void {\n if (absent(status)) return;\n const object = record(status);\n const [variant, ...others] = object ? Object.keys(object) : [];\n const agrees =\n object !== null &&\n others.length === 0 &&\n (err === null\n ? variant === 'Ok' && object.Ok === null\n : variant === 'Err' &&\n canonicalJson(executionError(object.Err)) === canonicalJson(err));\n if (!agrees) throw malformed('transaction status');\n}\n\nfunction tokenBalances(value: unknown, keys: number): Map<number, TokenBalance> {\n if (!Array.isArray(value)) throw malformed('token balances');\n const balances = new Map<number, TokenBalance>();\n for (const entry of value) {\n const balance = record(entry);\n const index = balance?.accountIndex;\n if (\n !balance ||\n typeof index !== 'number' ||\n !Number.isInteger(index) ||\n index < 0 ||\n index >= keys ||\n balances.has(index)\n ) {\n throw malformed('token balances');\n }\n const owner = optionalAddress(balance.owner, 'token balances');\n const programId = optionalAddress(balance.programId, 'token balances');\n balances.set(index, {\n mint: address(balance.mint, 'token balances'),\n ...(owner !== undefined ? { owner } : {}),\n ...(programId !== undefined ? { programId } : {}),\n amount: amountString(record(balance.uiTokenAmount)?.amount, 'token amount'),\n });\n }\n return balances;\n}\n\nfunction instruction(value: unknown, locator: string, inner: boolean): Instruction {\n const ix = record(value);\n if (!ix) throw malformed('instruction');\n const programId = address(ix.programId, 'instruction');\n const { parsed } = ix;\n const object = record(parsed);\n if (!absent(parsed) && !object && typeof parsed !== 'string') {\n throw malformed('instruction');\n }\n // A parsed memo is its UTF-8 text. The packet bounds an outer one, so a longer one is\n // malformed. An inner one is a CPI's data, and a reader never refuses what the chain\n // accepts: past the CPI data limit, the text is not kept and the decoding is partial.\n const tooLong =\n typeof parsed === 'string' &&\n parsed.length > (inner ? MAX_CPI_INSTRUCTION_DATA : MAX_TRANSACTION_SIZE);\n if (tooLong && !inner) throw malformed('instruction');\n return {\n locator,\n inner,\n programId,\n ...(typeof object?.type === 'string' ? { type: object.type } : {}),\n info: record(object?.info),\n ...(typeof parsed === 'string'\n ? tooLong\n ? { textTooLong: true as const }\n : { parsedText: parsed }\n : {}),\n };\n}\n\n/** Outer instructions, each followed by its inner ones (a group per outer instruction). */\nfunction instructions(outer: readonly unknown[], groups: unknown): Instruction[] {\n if (outer.length > MAX_OUTER_INSTRUCTIONS) throw malformed('instructions');\n const inner = new Map<number, readonly unknown[]>();\n if (!absent(groups)) {\n if (!Array.isArray(groups)) throw malformed('inner instructions');\n for (const group of groups) {\n const g = record(group);\n const index = g?.index;\n if (\n !g ||\n typeof index !== 'number' ||\n !Number.isInteger(index) ||\n index < 0 ||\n index >= outer.length ||\n inner.has(index) ||\n !Array.isArray(g.instructions) ||\n g.instructions.length > MAX_INNER_INSTRUCTIONS\n ) {\n throw malformed('inner instructions');\n }\n inner.set(index, g.instructions);\n }\n }\n return outer.flatMap((ix, i) => [\n instruction(ix, `ix:${i}`, false),\n ...(inner.get(i) ?? []).map((child, j) => instruction(child, `ix:${i}.${j}`, true)),\n ]);\n}\n\n/**\n * Validates a `jsonParsed` transaction (from `getTransaction` or a block's list). With\n * `signature`, the answer must be that transaction: a lookup answered with another one\n * decides nothing (a retryable \"not yet\"), never reads as ours.\n */\nexport function parseTransaction(value: unknown, signature?: string): ParsedTransaction {\n const tx = record(value);\n const meta = record(tx?.meta);\n const transaction = record(tx?.transaction);\n const message = record(transaction?.message);\n if (!tx || !meta || !transaction || !message) throw malformed('transaction');\n const signatures = transaction.signatures;\n const id: unknown = Array.isArray(signatures) ? signatures[0] : undefined;\n if (!text(id, MAX_SIGNATURE_CHARS)) throw malformed('transaction signatures');\n if (signature !== undefined && id !== signature) {\n throw notYet('the transaction asked for');\n }\n const accountKeys = message.accountKeys;\n if (\n !Array.isArray(accountKeys) ||\n accountKeys.length === 0 ||\n accountKeys.length > MAX_ACCOUNT_KEYS\n ) {\n throw malformed('account keys');\n }\n const accountIndex = new Map<string, number>();\n const keys = accountKeys.map((key: unknown, i) => {\n const pubkey = address(record(key)?.pubkey ?? key, 'account keys');\n if (accountIndex.has(pubkey)) throw malformed('account keys');\n accountIndex.set(pubkey, i);\n return pubkey;\n });\n const balances = (field: unknown) => {\n if (!Array.isArray(field) || field.length !== keys.length) {\n throw malformed('balances');\n }\n return field.map((v) => u64(v, 'balance'));\n };\n const { preTokenBalances, postTokenBalances } = meta;\n if (absent(preTokenBalances) !== absent(postTokenBalances)) {\n throw malformed('token balances');\n }\n if (!Array.isArray(message.instructions)) throw malformed('instructions');\n const version =\n tx.version === undefined || tx.version === 'legacy' ? 'legacy' : tx.version;\n if (\n version !== 'legacy' &&\n (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 0)\n ) {\n throw malformed('version');\n }\n const err = executionError(meta.err);\n checkStatus(meta.status, err);\n return {\n signature: id,\n keys,\n accountIndex,\n err,\n fee: u64(meta.fee, 'fee'),\n preBalances: balances(meta.preBalances),\n postBalances: balances(meta.postBalances),\n preTokens: absent(preTokenBalances)\n ? new Map()\n : tokenBalances(preTokenBalances, keys.length),\n postTokens: absent(postTokenBalances)\n ? new Map()\n : tokenBalances(postTokenBalances, keys.length),\n tokenBalances: absent(preTokenBalances) ? 'absent' : 'present',\n innerInstructions: absent(meta.innerInstructions) ? 'absent' : 'present',\n instructions: instructions(message.instructions, meta.innerInstructions),\n version,\n ...(tx.slot !== undefined ? { slot: u64(tx.slot, 'slot') } : {}),\n ...(typeof tx.blockTime === 'number' && Number.isSafeInteger(tx.blockTime)\n ? { blockTime: tx.blockTime }\n : {}),\n };\n}\n\ninterface NativeMove {\n readonly from: string;\n readonly to: string;\n readonly amount: bigint;\n}\n\ninterface TokenMove {\n readonly source: string;\n readonly destination: string;\n readonly authority?: string;\n readonly mint?: string;\n readonly amount: bigint;\n}\n\nfunction nativeMove(ix: Instruction): NativeMove | null {\n if (ix.programId !== SYSTEM_PROGRAM || !ix.info) return null;\n const { info } = ix;\n const to =\n ix.type === 'transfer' || ix.type === 'transferWithSeed'\n ? info.destination\n : ix.type === 'createAccount' || ix.type === 'createAccountWithSeed'\n ? info.newAccount\n : undefined;\n if (to === undefined) return null;\n return {\n from: address(info.source, 'system instruction'),\n to: address(to, 'system instruction'),\n amount: u64(info.lamports, 'lamports'),\n };\n}\n\nfunction tokenMove(ix: Instruction): TokenMove | null {\n if (ix.programId !== TOKEN_PROGRAM || !ix.info) return null;\n if (ix.type !== 'transfer' && ix.type !== 'transferChecked') return null;\n const { info } = ix;\n const authority = optionalAddress(\n info.authority ?? info.multisigAuthority,\n 'token instruction',\n );\n const mint = optionalAddress(info.mint, 'token instruction');\n const raw = ix.type === 'transfer' ? info.amount : record(info.tokenAmount)?.amount;\n return {\n source: address(info.source, 'token instruction'),\n destination: address(info.destination, 'token instruction'),\n ...(authority !== undefined ? { authority } : {}),\n ...(mint !== undefined ? { mint } : {}),\n amount: amountString(raw, 'token amount'),\n };\n}\n\n/** A parsed memo instruction (its text kept, or too long to keep). */\nconst isMemo = (ix: Instruction): boolean =>\n (ix.programId === MEMO_PROGRAM || ix.programId === MEMO_V1_PROGRAM) &&\n (ix.parsedText !== undefined || ix.textTooLong === true);\n\n/** A token program ran, or could have: named by an instruction, or keyed for a CPI. */\nconst tokenProgramKeyed = (tx: ParsedTransaction): boolean =>\n TOKEN_PROGRAMS.some((program) => tx.accountIndex.has(program)) ||\n tx.instructions.some((ix) => TOKEN_PROGRAMS.includes(ix.programId));\n\nconst add = (totals: Map<string, bigint>, key: string, amount: bigint): void => {\n totals.set(key, (totals.get(key) ?? 0n) + amount);\n};\n\n/** Token amounts moved per account and mint (`<index>:<mint>`), as the balances report. */\nfunction reportedTokenMoves(tx: ParsedTransaction): Map<string, bigint> {\n const moved = new Map<string, bigint>();\n for (const [index, balance] of tx.preTokens) {\n add(moved, `${index}:${balance.mint}`, -balance.amount);\n }\n for (const [index, balance] of tx.postTokens) {\n add(moved, `${index}:${balance.mint}`, balance.amount);\n }\n return moved;\n}\n\nfunction tokensReconcile(\n tx: ParsedTransaction,\n moves: readonly { readonly move: TokenMove; readonly mint: string }[],\n): boolean {\n const expected = new Map<string, bigint>();\n for (const { move, mint } of moves) {\n const from = tx.accountIndex.get(move.source);\n const to = tx.accountIndex.get(move.destination);\n if (from === undefined || to === undefined) return false;\n add(expected, `${from}:${mint}`, -move.amount);\n add(expected, `${to}:${mint}`, move.amount);\n }\n const actual = reportedTokenMoves(tx);\n for (const key of new Set([...actual.keys(), ...expected.keys()])) {\n if ((actual.get(key) ?? 0n) !== (expected.get(key) ?? 0n)) return false;\n }\n return true;\n}\n\nfunction lamportsReconcile(tx: ParsedTransaction, moves: readonly NativeMove[]): boolean {\n const expected = new Map<number, bigint>([[0, -tx.fee]]);\n for (const move of moves) {\n const from = tx.accountIndex.get(move.from);\n const to = tx.accountIndex.get(move.to);\n if (from === undefined || to === undefined) return false;\n expected.set(from, (expected.get(from) ?? 0n) - move.amount);\n expected.set(to, (expected.get(to) ?? 0n) + move.amount);\n }\n return tx.keys.every(\n (_, i) =>\n (tx.postBalances[i] as bigint) - (tx.preBalances[i] as bigint) ===\n (expected.get(i) ?? 0n),\n );\n}\n\n/**\n * A vote transaction: consensus traffic, moving nothing but its fee (skipped by scans). A\n * vote-program transaction that moves value, such as a vote-account withdrawal, is not one:\n * a scan must still see it.\n */\nexport const isVote = (tx: ParsedTransaction): boolean =>\n tx.instructions.length > 0 &&\n tx.instructions.every((ix) => ix.programId === VOTE_PROGRAM) &&\n lamportsReconcile(tx, []) &&\n tokensReconcile(tx, []);\n\nconst tokenAt = (tx: ParsedTransaction, address: string) => {\n const index = tx.accountIndex.get(address);\n return index === undefined\n ? {}\n : { pre: tx.preTokens.get(index), post: tx.postTokens.get(index) };\n};\n\nconst ownerOf = (tx: ParsedTransaction, address: string): string | undefined => {\n const { pre, post } = tokenAt(tx, address);\n return post?.owner ?? pre?.owner;\n};\n\nconst mintOf = (tx: ParsedTransaction, move: TokenMove): string | undefined => {\n if (move.mint !== undefined) return move.mint;\n for (const address of [move.source, move.destination]) {\n const { pre, post } = tokenAt(tx, address);\n const mint = post?.mint ?? pre?.mint;\n if (mint !== undefined) return mint;\n }\n return undefined;\n};\n\n/** Where a transaction sits: the block's dense height and hash (never the slot). */\nexport interface BlockPlace {\n readonly height: bigint;\n readonly hash: string;\n readonly blockTime?: number;\n}\n\n/** Decodes a parsed transaction as the chain reports it. */\nexport function decodeTransaction(\n tx: ParsedTransaction,\n place: BlockPlace,\n): DriverTransaction {\n const success = tx.err === null;\n const memos = tx.instructions.filter(isMemo);\n // The one memo, when its text was kept.\n const memo = memos.length === 1 ? memos[0]?.parsedText : undefined;\n // A failed transaction moved nothing but its fee. A successful one can be checked only\n // with its inner instructions, and with its token balances when a token program ran. A\n // text too long to keep is unexplained too.\n let complete =\n (!success ||\n (tx.innerInstructions === 'present' &&\n (tx.tokenBalances === 'present' || !tokenProgramKeyed(tx)))) &&\n !tx.instructions.some((ix) => ix.textTooLong);\n const natives: NativeMove[] = [];\n const tokens: { readonly move: TokenMove; readonly mint: string }[] = [];\n const transfers: DriverTransfer[] = [];\n for (const ix of success ? tx.instructions : []) {\n const native = nativeMove(ix);\n if (native) {\n natives.push(native);\n transfers.push({\n locator: ix.locator,\n from: [native.from],\n to: native.to,\n asset: 'native',\n amount: native.amount,\n source: ix.inner ? 'internal' : 'native',\n ...(memo !== undefined ? { memo } : {}),\n });\n continue;\n }\n const move = tokenMove(ix);\n if (!move) continue;\n const mint = mintOf(tx, move);\n if (mint === undefined) {\n complete = false;\n continue;\n }\n tokens.push({ move, mint });\n const from = ownerOf(tx, move.source);\n const to = ownerOf(tx, move.destination);\n // Without the owners the node did not report, the token accounts stand in for them.\n if (from === undefined || to === undefined) complete = false;\n transfers.push({\n locator: ix.locator,\n from: [from ?? move.source],\n to: to ?? move.destination,\n asset: { standard: 'spl', contract: mint },\n amount: move.amount,\n source: 'token-event',\n ...(memo !== undefined ? { memo } : {}),\n });\n }\n if (!lamportsReconcile(tx, natives) || !tokensReconcile(tx, tokens)) complete = false;\n return {\n id: tx.signature,\n observation: {\n seen: 'block',\n txHash: tx.signature,\n blockHeight: place.height,\n blockHash: place.hash,\n success,\n ...(success ? {} : { reason: 'transaction failed' }),\n },\n fee: [{ asset: 'native', amount: tx.fee }],\n transfers,\n decoding: complete ? 'complete' : 'partial',\n ...(place.blockTime !== undefined ? { timestamp: place.blockTime } : {}),\n details: {\n ...(tx.slot !== undefined ? { slot: tx.slot } : {}),\n version: tx.version,\n ...(success ? {} : { err: canonicalJson(tx.err) }),\n },\n };\n}\n\n/**\n * The scan filter. A scan must return at least every transaction with a transfer from or\n * to the addresses, so this is a conservative superset over wallets and token accounts\n * alike: a decoded transfer names a watched address; a successful token transfer moves\n * tokens into or out of a watched token account (its decoded transfer names the owners\n * instead); the decoding is partial and a watched address is among the account keys; a\n * watched account's lamports changed; the node reported no token balances and a token\n * program ran or was keyed (a deposit into an existing token account names no owner\n * then); or a token holding changed (per account and mint) whose owner is watched or was\n * not reported (it cannot be attributed). A watched token account's holding cannot change\n * unnoticed: a change no parsed transfer explains makes the decoding partial, and the\n * account is a key.\n */\nexport function touches(\n decoded: DriverTransaction,\n tx: ParsedTransaction,\n addresses: ReadonlySet<string>,\n): boolean {\n const named = decoded.transfers.some(\n (transfer) =>\n addresses.has(transfer.to) || transfer.from.some((f) => addresses.has(f)),\n );\n if (named) return true;\n // `decodeTransaction` already read these instructions: none of them throws here.\n const account =\n tx.err === null &&\n tx.instructions.some((ix) => {\n const move = tokenMove(ix);\n return (\n move !== null && (addresses.has(move.source) || addresses.has(move.destination))\n );\n });\n if (account) return true;\n const keyed = tx.keys.some((key) => addresses.has(key));\n if (keyed && decoded.decoding === 'partial') return true;\n const lamportsMoved = tx.keys.some(\n (key, i) => addresses.has(key) && tx.preBalances[i] !== tx.postBalances[i],\n );\n if (lamportsMoved) return true;\n if (tx.tokenBalances === 'absent' && tokenProgramKeyed(tx)) return true;\n const indexes = new Set([...tx.preTokens.keys(), ...tx.postTokens.keys()]);\n for (const index of indexes) {\n const pre = tx.preTokens.get(index);\n const post = tx.postTokens.get(index);\n const moved =\n pre?.mint === post?.mint\n ? (pre?.amount ?? 0n) !== (post?.amount ?? 0n)\n : (pre?.amount ?? 0n) !== 0n || (post?.amount ?? 0n) !== 0n;\n if (!moved) continue;\n for (const balance of [pre, post]) {\n if (balance && (balance.owner === undefined || addresses.has(balance.owner))) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * An account's balance of `mint` before and after, as the classic Token program holds it.\n * The owning program comes from each balance's `programId`, which the provider must report\n * (current agave does). Through a provider that leaves it out, no SPL verdict ever decides:\n * a cost in liveness only, never a wrong verdict.\n */\nfunction holding(\n tx: ParsedTransaction,\n address: string,\n mint: string,\n): { readonly pre?: bigint; readonly post: bigint } {\n const index = tx.accountIndex.get(address);\n if (index === undefined) throw notYet('the accounts of the token transfer');\n const pre = tx.preTokens.get(index);\n const post = tx.postTokens.get(index);\n // A successful transfer leaves both accounts in place: no balance is missing evidence.\n if (!post) throw notYet('the token balances of the transfer');\n for (const balance of [pre, post]) {\n if (!balance) continue;\n if (balance.programId === undefined) {\n throw notYet('the token balances of the transfer');\n }\n if (balance.mint !== mint || balance.programId !== TOKEN_PROGRAM) {\n throw inconsistent('the token balances do not match the signed transfer');\n }\n }\n return { ...(pre ? { pre: pre.amount } : {}), post: post.amount };\n}\n\n/** One of the sender's transfers, read from the balances by account, mint and program. */\nfunction landed(tx: ParsedTransaction, move: TokenMove): boolean {\n // We sign `transferChecked` only, which names its mint.\n if (move.mint === undefined) {\n throw inconsistent('the token instructions do not match the signed transaction');\n }\n const source = holding(tx, move.source, move.mint);\n const destination = holding(tx, move.destination, move.mint);\n // The sender's account held the tokens before the transfer (only a recipient's account\n // can be created by the same transaction).\n if (source.pre === undefined) throw notYet('the token balances of the transfer');\n // A zero-amount record moved nothing; a transfer to itself cannot show in balances.\n if (move.amount === 0n) return false;\n if (move.source === move.destination) return true;\n return source.post - source.pre < 0n && destination.post - (destination.pre ?? 0n) > 0n;\n}\n\n/**\n * The phantom-success guard, for verdict\n * paths only: a token transfer counts as executed only when the balances show a transfer\n * of a positive amount from the sender's account to the intended recipient's account, of\n * the signed mint, in accounts the classic Token program owns. The exact amount is not\n * required (fee-on-transfer tokens exist). The intended recipient is the destination of\n * the sender's own signed instruction. Missing evidence (no token balances, a balance or\n * its owning program not reported, an unparsed instruction, accounts not in the keys)\n * decides nothing (a retryable `PROVIDER_UNAVAILABLE`), and so does an answer that\n * contradicts the signed message: token instructions, none of them by the sender, where\n * the sender signed its own `transferChecked`, or balances of another mint or program\n * (a retryable `PROVIDER_INCONSISTENT`). Seeing no transfer never\n * passes; a failed transaction never lands; a native transfer keeps the chain's status.\n * The balances must carry `programId` (current agave reports it): without it, SPL verdicts\n * through that provider never decide, which costs liveness only.\n */\nexport function tokenTransfersLanded(tx: ParsedTransaction, from: string): boolean {\n if (tx.err !== null) return false;\n const tokenInstructions = tx.instructions.filter(\n (ix) => !ix.inner && TOKEN_PROGRAMS.includes(ix.programId),\n );\n // A native transfer: the chain's own status is the verdict.\n if (tokenInstructions.length === 0) return true;\n if (tokenInstructions.some((ix) => !ix.info)) {\n throw notYet('the parsed token instructions');\n }\n const ours = tokenInstructions.flatMap((ix) => {\n const move = tokenMove(ix);\n return move && move.authority === from ? [move] : [];\n });\n if (ours.length === 0) {\n throw inconsistent('the token instructions do not match the signed transaction');\n }\n if (tx.tokenBalances === 'absent') throw notYet('the token balances');\n return ours.every((move) => landed(tx, move));\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Solana driver, over the `SolanaCodec` of `@solana/web3.js`. One factory
|
|
3
|
+
* serves every Solana cluster; each network's registry data configures it.
|
|
4
|
+
*
|
|
5
|
+
* Every I/O call carries the tags of the `ChainDriver` contract table (core
|
|
6
|
+
* `driver/types.ts`), with one documented exception on the proof paths (`proofs.ts`): the
|
|
7
|
+
* finalized height behind `finalizedHead` (the one unanchored head) and the
|
|
8
|
+
* height-to-slot lookups of `HeightIndex` are single-endpoint `monitor` reads. They are
|
|
9
|
+
* hints only: the proof quorum then attests the block they name, its height and its hash,
|
|
10
|
+
* so a wrong hint decides nothing.
|
|
11
|
+
*/
|
|
12
|
+
import type { DriverFactory } from '../../core/driver/types';
|
|
13
|
+
import type { Transport } from '../../core/transport/types';
|
|
14
|
+
import type { SolanaCodec } from './types';
|
|
15
|
+
export declare function solanaDriverFactory(makeCodec: (transport: Transport) => SolanaCodec): DriverFactory;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.solanaDriverFactory = solanaDriverFactory;
|
|
4
|
+
const bytes_1 = require("../../core/util/bytes");
|
|
5
|
+
const builder_1 = require("./builder");
|
|
6
|
+
const fees_1 = require("./fees");
|
|
7
|
+
const heights_1 = require("./heights");
|
|
8
|
+
const history_1 = require("./history");
|
|
9
|
+
const keys_1 = require("./keys");
|
|
10
|
+
const network_1 = require("./network");
|
|
11
|
+
const proofs_1 = require("./proofs");
|
|
12
|
+
const reader_1 = require("./reader");
|
|
13
|
+
const rpc_1 = require("./rpc");
|
|
14
|
+
/** Identity is the genesis hash; the height is the `confirmed` block height. */
|
|
15
|
+
function probes(genesisHash) {
|
|
16
|
+
return {
|
|
17
|
+
identity: async (call) => {
|
|
18
|
+
const hash = await call.rpc('getGenesisHash', []);
|
|
19
|
+
if ((0, keys_1.decodeBase58)(hash, 32) === null)
|
|
20
|
+
throw (0, rpc_1.malformed)('getGenesisHash');
|
|
21
|
+
return hash;
|
|
22
|
+
},
|
|
23
|
+
expectedIdentity: genesisHash,
|
|
24
|
+
height: async (call) => (0, rpc_1.u64)(await call.rpc('getBlockHeight', [{ commitment: 'confirmed' }]), 'height'),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function solanaDriverFactory(makeCodec) {
|
|
28
|
+
return {
|
|
29
|
+
async create(ctx) {
|
|
30
|
+
const config = (0, network_1.solanaNetworkConfig)(ctx.chain, ctx.network, ctx.options);
|
|
31
|
+
// Probes go on every transport this driver receives, the indexer included, before
|
|
32
|
+
// any traffic: a Solana transaction names no cluster, and only the genesis hash
|
|
33
|
+
// keeps another cluster's endpoint out.
|
|
34
|
+
ctx.transport.setProbes(probes(config.genesisHash));
|
|
35
|
+
ctx.indexer?.setProbes(probes(config.genesisHash));
|
|
36
|
+
const codec = makeCodec(ctx.transport);
|
|
37
|
+
// A random start for the build variants (fees.ts): distinct across processes.
|
|
38
|
+
const seed = (0, bytes_1.randomBytes)(4);
|
|
39
|
+
const solana = {
|
|
40
|
+
transport: ctx.transport,
|
|
41
|
+
codec,
|
|
42
|
+
chain: ctx.chain,
|
|
43
|
+
network: ctx.network,
|
|
44
|
+
config,
|
|
45
|
+
heights: new heights_1.HeightIndex(ctx.transport),
|
|
46
|
+
log: ctx.log,
|
|
47
|
+
nextVariant: (0, fees_1.variantCounter)(new DataView(seed.buffer, seed.byteOffset, 4).getUint32(0)),
|
|
48
|
+
};
|
|
49
|
+
// History reads the indexer transport when one is configured.
|
|
50
|
+
const history = ctx.indexer
|
|
51
|
+
? { ...solana, transport: ctx.indexer, heights: new heights_1.HeightIndex(ctx.indexer) }
|
|
52
|
+
: solana;
|
|
53
|
+
const ext = (0, reader_1.createSolanaExt)(solana);
|
|
54
|
+
return {
|
|
55
|
+
ordering: 'expiry',
|
|
56
|
+
capabilities: config.capabilities,
|
|
57
|
+
address: (0, reader_1.createSolanaAddressCodec)(),
|
|
58
|
+
reader: (0, reader_1.createSolanaReader)(solana),
|
|
59
|
+
builder: (0, builder_1.createSolanaBuilder)(solana),
|
|
60
|
+
broadcaster: (0, builder_1.createSolanaBroadcaster)(solana),
|
|
61
|
+
proofs: (0, proofs_1.createSolanaProofs)(solana),
|
|
62
|
+
blocks: (0, proofs_1.createSolanaBlocks)(solana),
|
|
63
|
+
history: (0, history_1.createSolanaHistory)(history),
|
|
64
|
+
ext: { solana: { getTokenAccounts: ext.solana.getTokenAccounts } },
|
|
65
|
+
limits: () => ({ maxOutputs: 1 }),
|
|
66
|
+
// A fresh `Connection` on every call, never a shared one.
|
|
67
|
+
createNativeClient: () => codec.createNative(),
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../../src/adapters/solana/driver.ts"],"names":[],"mappings":";;AA+CA,kDAgDC;AAlFD,iDAAoD;AACpD,uCAAyE;AACzE,iCAAwC;AACxC,uCAAwC;AACxC,uCAAgD;AAChD,iCAAsC;AACtC,uCAAgD;AAChD,qCAAkE;AAClE,qCAKkB;AAClB,+BAAuC;AAGvC,gFAAgF;AAChF,SAAS,MAAM,CAAC,WAAmB;IACjC,OAAO;QACL,QAAQ,EAAE,KAAK,EAAE,IAAkB,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,M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C;AACJ,CAAC","sourcesContent":["/**\n * The Solana driver, over the `SolanaCodec` of `@solana/web3.js`. One factory\n * serves every Solana cluster; each network's registry data configures it.\n *\n * Every I/O call carries the tags of the `ChainDriver` contract table (core\n * `driver/types.ts`), with one documented exception on the proof paths (`proofs.ts`): the\n * finalized height behind `finalizedHead` (the one unanchored head) and the\n * height-to-slot lookups of `HeightIndex` are single-endpoint `monitor` reads. They are\n * hints only: the proof quorum then attests the block they name, its height and its hash,\n * so a wrong hint decides nothing.\n */\nimport type { ChainDriver, DriverFactory } from '../../core/driver/types';\nimport type { EndpointCall, HealthProbes, Transport } from '../../core/transport/types';\nimport { randomBytes } from '../../core/util/bytes';\nimport { createSolanaBroadcaster, createSolanaBuilder } from './builder';\nimport { variantCounter } from './fees';\nimport { HeightIndex } from './heights';\nimport { createSolanaHistory } from './history';\nimport { decodeBase58 } from './keys';\nimport { solanaNetworkConfig } from './network';\nimport { createSolanaBlocks, createSolanaProofs } from './proofs';\nimport {\n createSolanaAddressCodec,\n createSolanaExt,\n createSolanaReader,\n type SolanaContext,\n} from './reader';\nimport { malformed, u64 } from './rpc';\nimport type { SolanaCodec } from './types';\n\n/** Identity is the genesis hash; the height is the `confirmed` block height. */\nfunction probes(genesisHash: string): HealthProbes {\n return {\n identity: async (call: EndpointCall) => {\n const hash = await call.rpc<unknown>('getGenesisHash', []);\n if (decodeBase58(hash, 32) === null) throw malformed('getGenesisHash');\n return hash as string;\n },\n expectedIdentity: genesisHash,\n height: async (call: EndpointCall) =>\n u64(\n await call.rpc<unknown>('getBlockHeight', [{ commitment: 'confirmed' }]),\n 'height',\n ),\n };\n}\n\nexport function solanaDriverFactory(\n makeCodec: (transport: Transport) => SolanaCodec,\n): DriverFactory {\n return {\n async create(ctx): Promise<ChainDriver> {\n const config = solanaNetworkConfig(ctx.chain, ctx.network, ctx.options);\n // Probes go on every transport this driver receives, the indexer included, before\n // any traffic: a Solana transaction names no cluster, and only the genesis hash\n // keeps another cluster's endpoint out.\n ctx.transport.setProbes(probes(config.genesisHash));\n ctx.indexer?.setProbes(probes(config.genesisHash));\n const codec = makeCodec(ctx.transport);\n // A random start for the build variants (fees.ts): distinct across processes.\n const seed = randomBytes(4);\n const solana: SolanaContext = {\n transport: ctx.transport,\n codec,\n chain: ctx.chain,\n network: ctx.network,\n config,\n heights: new HeightIndex(ctx.transport),\n log: ctx.log,\n nextVariant: variantCounter(\n new DataView(seed.buffer, seed.byteOffset, 4).getUint32(0),\n ),\n };\n // History reads the indexer transport when one is configured.\n const history = ctx.indexer\n ? { ...solana, transport: ctx.indexer, heights: new HeightIndex(ctx.indexer) }\n : solana;\n const ext = createSolanaExt(solana);\n return {\n ordering: 'expiry',\n capabilities: config.capabilities,\n address: createSolanaAddressCodec(),\n reader: createSolanaReader(solana),\n builder: createSolanaBuilder(solana),\n broadcaster: createSolanaBroadcaster(solana),\n proofs: createSolanaProofs(solana),\n blocks: createSolanaBlocks(solana),\n history: createSolanaHistory(history),\n ext: { solana: { getTokenAccounts: ext.solana.getTokenAccounts } },\n limits: () => ({ maxOutputs: 1 }),\n // A fresh `Connection` on every call, never a shared one.\n createNativeClient: () => codec.createNative(),\n };\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Broadcast classification. `rejected` is only for bytes that are invalid by construction
|
|
3
|
+
* on every node: a signature that does not verify. Everything that depends on state,
|
|
4
|
+
* time, fork or node policy (an unknown or expired blockhash, balances, rent, account
|
|
5
|
+
* locks, versions, sizes) is `refused`, and so is every error not listed. Reasons are
|
|
6
|
+
* fixed literals that never repeat the node's text, which can carry addresses or amounts.
|
|
7
|
+
*
|
|
8
|
+
* A preflight failure (`-32002`) carries the simulation result as its `data`, whose `err` is
|
|
9
|
+
* agave's `TransactionError` in serde's form (`"BlockhashNotFound"`,
|
|
10
|
+
* `{"InstructionError":[3,{"Custom":1}]}`). When that result is readable it decides, not the
|
|
11
|
+
* text one endpoint chose to show; otherwise the texts decide: agave's `TransactionError`
|
|
12
|
+
* displays behind `sendTransaction`'s preflight prefix, matched whole.
|
|
13
|
+
*
|
|
14
|
+
* A node's rejection is a claim. `classifyBroadcastError` takes the node
|
|
15
|
+
* at its word; `classifyOwnBroadcast`, which the broadcaster uses, keeps a `rejected` only
|
|
16
|
+
* when the bytes that were sent really carry a signature that does not verify, checked here
|
|
17
|
+
* with the core's own ed25519 rule (the one that accepted our signer's signatures). A claim
|
|
18
|
+
* for bytes whose signatures all verify, or for bytes that do not read as one signed legacy
|
|
19
|
+
* transaction, is `refused`, which is not terminal. A terminal `rejected` lets a caller pay
|
|
20
|
+
* again, so an endpoint that relayed the bytes, or keeps them to relay later, would make
|
|
21
|
+
* that a second payment. The core verifies every signature before it is stored, so a true
|
|
22
|
+
* rejection of our own Attempt should not happen; a refusal costs liveness only, and the
|
|
23
|
+
* expiry proof still ends the Operation.
|
|
24
|
+
*/
|
|
25
|
+
import type { BroadcastResult } from '../../core/driver/types';
|
|
26
|
+
/**
|
|
27
|
+
* Classifies a definitive `sendTransaction` error: its JSON-RPC code, its message and, when
|
|
28
|
+
* the node sent one, its `data` (`details.rpcData`).
|
|
29
|
+
*/
|
|
30
|
+
export declare function classifyBroadcastError(code: number | undefined, message: string, data?: unknown): BroadcastResult;
|
|
31
|
+
/**
|
|
32
|
+
* The node's answer to `sent`, the bytes this driver sent. A `rejected` stands
|
|
33
|
+
* only when `sent` carries a signature that does not verify; otherwise the answer is
|
|
34
|
+
* `refused`. Every other answer is the node's, as `classifyBroadcastError` reads it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function classifyOwnBroadcast(sent: Uint8Array, code: number | undefined, message: string, data?: unknown): BroadcastResult;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyBroadcastError = classifyBroadcastError;
|
|
4
|
+
exports.classifyOwnBroadcast = classifyOwnBroadcast;
|
|
5
|
+
const schemes_1 = require("../../core/registry/schemes");
|
|
6
|
+
const programs_1 = require("./programs");
|
|
7
|
+
const rpc_1 = require("./rpc");
|
|
8
|
+
const wire_1 = require("./wire");
|
|
9
|
+
const PREFLIGHT = 'Transaction simulation failed: ';
|
|
10
|
+
const refused = (code, reason) => Object.freeze({ kind: 'refused', code, reason });
|
|
11
|
+
const ALREADY_KNOWN_RESULT = Object.freeze({ kind: 'already-known' });
|
|
12
|
+
const INVALID_SIGNATURE = Object.freeze({
|
|
13
|
+
kind: 'rejected',
|
|
14
|
+
reason: 'invalid signature',
|
|
15
|
+
});
|
|
16
|
+
const BLOCKHASH_NOT_FOUND = refused('TX_REFUSED', 'blockhash not found');
|
|
17
|
+
const INSUFFICIENT_FUNDS = refused('INSUFFICIENT_FUNDS', 'insufficient funds');
|
|
18
|
+
const INSUFFICIENT_FOR_FEE = refused('INSUFFICIENT_FUNDS', 'insufficient funds for fee');
|
|
19
|
+
const INSUFFICIENT_FOR_RENT = refused('INSUFFICIENT_FUNDS', 'insufficient funds for rent');
|
|
20
|
+
const DEFAULT_REFUSAL = refused('TX_REFUSED', 'refused by the node');
|
|
21
|
+
/** Anchored, whole-message texts. */
|
|
22
|
+
const ALREADY_KNOWN = `${PREFLIGHT}This transaction has already been processed`;
|
|
23
|
+
/** The two signature texts, each only under its own code. */
|
|
24
|
+
const REJECTED = [
|
|
25
|
+
{
|
|
26
|
+
code: rpc_1.RPC_CODES.SEND_TRANSACTION_PREFLIGHT_FAILURE,
|
|
27
|
+
text: `${PREFLIGHT}Transaction did not pass signature verification`,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
code: rpc_1.RPC_CODES.TRANSACTION_SIGNATURE_VERIFICATION_FAILURE,
|
|
31
|
+
text: 'Transaction signature verification failure',
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
const REFUSED = [
|
|
35
|
+
{
|
|
36
|
+
pattern: /^Transaction simulation failed: Blockhash not found$/,
|
|
37
|
+
result: BLOCKHASH_NOT_FOUND,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
pattern: /^Transaction simulation failed: Attempt to debit an account but found no record of a prior credit\.$/,
|
|
41
|
+
result: INSUFFICIENT_FUNDS,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
pattern: /^Transaction simulation failed: Insufficient funds for fee$/,
|
|
45
|
+
result: INSUFFICIENT_FOR_FEE,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
pattern: /^Transaction simulation failed: Transaction results in an account \(\d+\) with insufficient funds for rent$/,
|
|
49
|
+
result: INSUFFICIENT_FOR_RENT,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
// System `ResultWithNegativeLamports` and Token `InsufficientFunds` are both error 1,
|
|
53
|
+
// the only programs of ours that return it.
|
|
54
|
+
pattern: /^Transaction simulation failed: Error processing Instruction \d+: custom program error: 0x1$/,
|
|
55
|
+
result: INSUFFICIENT_FUNDS,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pattern: /^Transaction simulation failed: Error processing Instruction \d+: insufficient funds for instruction$/,
|
|
59
|
+
result: INSUFFICIENT_FUNDS,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
/**
|
|
63
|
+
* The `err` of a preflight failure's simulation result (the transport's `rpcData`, a JSON
|
|
64
|
+
* text, or the object itself); `undefined` when there is none or it cannot be read. The
|
|
65
|
+
* transport keeps only the first 512 characters, so a long log list makes it unreadable.
|
|
66
|
+
*/
|
|
67
|
+
function simulationError(data) {
|
|
68
|
+
let result = data;
|
|
69
|
+
if (typeof data === 'string') {
|
|
70
|
+
try {
|
|
71
|
+
result = JSON.parse(data);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const body = (0, rpc_1.record)(result);
|
|
78
|
+
return body && 'err' in body ? body.err : undefined;
|
|
79
|
+
}
|
|
80
|
+
/** The refusal a structured `TransactionError` means, as the texts above do. */
|
|
81
|
+
function refusalFor(err) {
|
|
82
|
+
switch (err) {
|
|
83
|
+
case 'BlockhashNotFound':
|
|
84
|
+
return BLOCKHASH_NOT_FOUND;
|
|
85
|
+
case 'AccountNotFound':
|
|
86
|
+
return INSUFFICIENT_FUNDS;
|
|
87
|
+
case 'InsufficientFundsForFee':
|
|
88
|
+
return INSUFFICIENT_FOR_FEE;
|
|
89
|
+
}
|
|
90
|
+
const tagged = (0, rpc_1.record)(err);
|
|
91
|
+
if (tagged && 'InsufficientFundsForRent' in tagged)
|
|
92
|
+
return INSUFFICIENT_FOR_RENT;
|
|
93
|
+
const instruction = tagged?.InstructionError;
|
|
94
|
+
if (Array.isArray(instruction) && instruction.length === 2) {
|
|
95
|
+
const detail = instruction[1];
|
|
96
|
+
if (detail === 'InsufficientFunds' || (0, rpc_1.record)(detail)?.Custom === 1) {
|
|
97
|
+
return INSUFFICIENT_FUNDS;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return DEFAULT_REFUSAL;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Classifies a definitive `sendTransaction` error: its JSON-RPC code, its message and, when
|
|
104
|
+
* the node sent one, its `data` (`details.rpcData`).
|
|
105
|
+
*/
|
|
106
|
+
function classifyBroadcastError(code, message, data) {
|
|
107
|
+
const err = code === rpc_1.RPC_CODES.SEND_TRANSACTION_PREFLIGHT_FAILURE
|
|
108
|
+
? simulationError(data)
|
|
109
|
+
: undefined;
|
|
110
|
+
// The safe answer (the core keeps watching the Attempt): either source suffices.
|
|
111
|
+
if (message === ALREADY_KNOWN || err === 'AlreadyProcessed')
|
|
112
|
+
return ALREADY_KNOWN_RESULT;
|
|
113
|
+
// The one verdict that ends an Attempt for good: the anchored text under its own code,
|
|
114
|
+
// and a readable structured error must agree with it.
|
|
115
|
+
if (REJECTED.some((entry) => entry.code === code && entry.text === message) &&
|
|
116
|
+
(err === undefined || err === 'SignatureFailure')) {
|
|
117
|
+
return INVALID_SIGNATURE;
|
|
118
|
+
}
|
|
119
|
+
if (err !== undefined)
|
|
120
|
+
return refusalFor(err);
|
|
121
|
+
return REFUSED.find((entry) => entry.pattern.test(message))?.result ?? DEFAULT_REFUSAL;
|
|
122
|
+
}
|
|
123
|
+
/** A rejection this driver cannot confirm for the bytes it sent: observed, never terminal. */
|
|
124
|
+
const CLAIMED_INVALID_SIGNATURE = refused('TX_REFUSED', 'the node claimed an invalid signature');
|
|
125
|
+
/**
|
|
126
|
+
* Whether `sent` carries a signature that does not verify (each signature against its
|
|
127
|
+
* signer's key, in order, over the message), or `undefined` when the bytes do not read as
|
|
128
|
+
* one signed legacy transaction within the packet limit (larger bytes are refused before
|
|
129
|
+
* any parsing).
|
|
130
|
+
*/
|
|
131
|
+
function carriesBadSignature(sent) {
|
|
132
|
+
if (sent.length > programs_1.MAX_TRANSACTION_SIZE)
|
|
133
|
+
return undefined;
|
|
134
|
+
const tx = (0, wire_1.parseSignedTransaction)(sent);
|
|
135
|
+
if (!tx)
|
|
136
|
+
return undefined;
|
|
137
|
+
return tx.signatures.some((signature, i) => !schemes_1.ed25519Scheme.verify({
|
|
138
|
+
publicKey: tx.parts.keys[i],
|
|
139
|
+
payload: tx.message,
|
|
140
|
+
signature,
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The node's answer to `sent`, the bytes this driver sent. A `rejected` stands
|
|
145
|
+
* only when `sent` carries a signature that does not verify; otherwise the answer is
|
|
146
|
+
* `refused`. Every other answer is the node's, as `classifyBroadcastError` reads it.
|
|
147
|
+
*/
|
|
148
|
+
function classifyOwnBroadcast(sent, code, message, data) {
|
|
149
|
+
const result = classifyBroadcastError(code, message, data);
|
|
150
|
+
if (result.kind !== 'rejected')
|
|
151
|
+
return result;
|
|
152
|
+
return carriesBadSignature(sent) === true ? result : CLAIMED_INVALID_SIGNATURE;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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ACzF,CAAC;AAED,8FAA8F;AAC9F,MAAM,yBAAyB,GAAG,OAAO,CACvC,YAAY,EACZ,uCAAuC,CACxC,CAAC;AAEF;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,IAAgB;IAC3C,IAAI,IAAI,CAAC,MAAM,GAAG,+BAAoB;QAAE,OAAO,SAAS,CAAC;IACzD,MAAM,EAAE,GAAG,IAAA,6BAAsB,EAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CACvB,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CACf,CAAC,uBAAa,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAe;QACzC,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,SAAS;KACV,CAAC,CACL,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,IAAgB,EAChB,IAAwB,EACxB,OAAe,EACf,IAAc;IAEd,MAAM,MAAM,GAAG,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3D,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,MAAM,CAAC;IAC9C,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,yBAAyB,CAAC;AACjF,CAAC","sourcesContent":["/**\n * Broadcast classification. `rejected` is only for bytes that are invalid by construction\n * on every node: a signature that does not verify. Everything that depends on state,\n * time, fork or node policy (an unknown or expired blockhash, balances, rent, account\n * locks, versions, sizes) is `refused`, and so is every error not listed. Reasons are\n * fixed literals that never repeat the node's text, which can carry addresses or amounts.\n *\n * A preflight failure (`-32002`) carries the simulation result as its `data`, whose `err` is\n * agave's `TransactionError` in serde's form (`\"BlockhashNotFound\"`,\n * `{\"InstructionError\":[3,{\"Custom\":1}]}`). When that result is readable it decides, not the\n * text one endpoint chose to show; otherwise the texts decide: agave's `TransactionError`\n * displays behind `sendTransaction`'s preflight prefix, matched whole.\n *\n * A node's rejection is a claim. `classifyBroadcastError` takes the node\n * at its word; `classifyOwnBroadcast`, which the broadcaster uses, keeps a `rejected` only\n * when the bytes that were sent really carry a signature that does not verify, checked here\n * with the core's own ed25519 rule (the one that accepted our signer's signatures). A claim\n * for bytes whose signatures all verify, or for bytes that do not read as one signed legacy\n * transaction, is `refused`, which is not terminal. A terminal `rejected` lets a caller pay\n * again, so an endpoint that relayed the bytes, or keeps them to relay later, would make\n * that a second payment. The core verifies every signature before it is stored, so a true\n * rejection of our own Attempt should not happen; a refusal costs liveness only, and the\n * expiry proof still ends the Operation.\n */\nimport type { BroadcastResult } from '../../core/driver/types';\nimport { ed25519Scheme } from '../../core/registry/schemes';\nimport { MAX_TRANSACTION_SIZE } from './programs';\nimport { RPC_CODES, record } from './rpc';\nimport { parseSignedTransaction } from './wire';\n\nconst PREFLIGHT = 'Transaction simulation failed: ';\n\ntype Refused = Extract<BroadcastResult, { kind: 'refused' }>;\n\nconst refused = (code: Refused['code'], reason: string): Refused =>\n Object.freeze({ kind: 'refused', code, reason });\n\nconst ALREADY_KNOWN_RESULT: BroadcastResult = Object.freeze({ kind: 'already-known' });\nconst INVALID_SIGNATURE: BroadcastResult = Object.freeze({\n kind: 'rejected',\n reason: 'invalid signature',\n});\nconst BLOCKHASH_NOT_FOUND = refused('TX_REFUSED', 'blockhash not found');\nconst INSUFFICIENT_FUNDS = refused('INSUFFICIENT_FUNDS', 'insufficient funds');\nconst INSUFFICIENT_FOR_FEE = refused('INSUFFICIENT_FUNDS', 'insufficient funds for fee');\nconst INSUFFICIENT_FOR_RENT = refused(\n 'INSUFFICIENT_FUNDS',\n 'insufficient funds for rent',\n);\nconst DEFAULT_REFUSAL = refused('TX_REFUSED', 'refused by the node');\n\n/** Anchored, whole-message texts. */\nconst ALREADY_KNOWN = `${PREFLIGHT}This transaction has already been processed`;\n\n/** The two signature texts, each only under its own code. */\nconst REJECTED: readonly { readonly code: number; readonly text: string }[] = [\n {\n code: RPC_CODES.SEND_TRANSACTION_PREFLIGHT_FAILURE,\n text: `${PREFLIGHT}Transaction did not pass signature verification`,\n },\n {\n code: RPC_CODES.TRANSACTION_SIGNATURE_VERIFICATION_FAILURE,\n text: 'Transaction signature verification failure',\n },\n];\n\nconst REFUSED: readonly { readonly pattern: RegExp; readonly result: Refused }[] = [\n {\n pattern: /^Transaction simulation failed: Blockhash not found$/,\n result: BLOCKHASH_NOT_FOUND,\n },\n {\n pattern:\n /^Transaction simulation failed: Attempt to debit an account but found no record of a prior credit\\.$/,\n result: INSUFFICIENT_FUNDS,\n },\n {\n pattern: /^Transaction simulation failed: Insufficient funds for fee$/,\n result: INSUFFICIENT_FOR_FEE,\n },\n {\n pattern:\n /^Transaction simulation failed: Transaction results in an account \\(\\d+\\) with insufficient funds for rent$/,\n result: INSUFFICIENT_FOR_RENT,\n },\n {\n // System `ResultWithNegativeLamports` and Token `InsufficientFunds` are both error 1,\n // the only programs of ours that return it.\n pattern:\n /^Transaction simulation failed: Error processing Instruction \\d+: custom program error: 0x1$/,\n result: INSUFFICIENT_FUNDS,\n },\n {\n pattern:\n /^Transaction simulation failed: Error processing Instruction \\d+: insufficient funds for instruction$/,\n result: INSUFFICIENT_FUNDS,\n },\n];\n\n/**\n * The `err` of a preflight failure's simulation result (the transport's `rpcData`, a JSON\n * text, or the object itself); `undefined` when there is none or it cannot be read. The\n * transport keeps only the first 512 characters, so a long log list makes it unreadable.\n */\nfunction simulationError(data: unknown): unknown {\n let result = data;\n if (typeof data === 'string') {\n try {\n result = JSON.parse(data) as unknown;\n } catch {\n return undefined;\n }\n }\n const body = record(result);\n return body && 'err' in body ? body.err : undefined;\n}\n\n/** The refusal a structured `TransactionError` means, as the texts above do. */\nfunction refusalFor(err: unknown): Refused {\n switch (err) {\n case 'BlockhashNotFound':\n return BLOCKHASH_NOT_FOUND;\n case 'AccountNotFound':\n return INSUFFICIENT_FUNDS;\n case 'InsufficientFundsForFee':\n return INSUFFICIENT_FOR_FEE;\n }\n const tagged = record(err);\n if (tagged && 'InsufficientFundsForRent' in tagged) return INSUFFICIENT_FOR_RENT;\n const instruction = tagged?.InstructionError;\n if (Array.isArray(instruction) && instruction.length === 2) {\n const detail: unknown = instruction[1];\n if (detail === 'InsufficientFunds' || record(detail)?.Custom === 1) {\n return INSUFFICIENT_FUNDS;\n }\n }\n return DEFAULT_REFUSAL;\n}\n\n/**\n * Classifies a definitive `sendTransaction` error: its JSON-RPC code, its message and, when\n * the node sent one, its `data` (`details.rpcData`).\n */\nexport function classifyBroadcastError(\n code: number | undefined,\n message: string,\n data?: unknown,\n): BroadcastResult {\n const err =\n code === RPC_CODES.SEND_TRANSACTION_PREFLIGHT_FAILURE\n ? simulationError(data)\n : undefined;\n // The safe answer (the core keeps watching the Attempt): either source suffices.\n if (message === ALREADY_KNOWN || err === 'AlreadyProcessed')\n return ALREADY_KNOWN_RESULT;\n // The one verdict that ends an Attempt for good: the anchored text under its own code,\n // and a readable structured error must agree with it.\n if (\n REJECTED.some((entry) => entry.code === code && entry.text === message) &&\n (err === undefined || err === 'SignatureFailure')\n ) {\n return INVALID_SIGNATURE;\n }\n if (err !== undefined) return refusalFor(err);\n return REFUSED.find((entry) => entry.pattern.test(message))?.result ?? DEFAULT_REFUSAL;\n}\n\n/** A rejection this driver cannot confirm for the bytes it sent: observed, never terminal. */\nconst CLAIMED_INVALID_SIGNATURE = refused(\n 'TX_REFUSED',\n 'the node claimed an invalid signature',\n);\n\n/**\n * Whether `sent` carries a signature that does not verify (each signature against its\n * signer's key, in order, over the message), or `undefined` when the bytes do not read as\n * one signed legacy transaction within the packet limit (larger bytes are refused before\n * any parsing).\n */\nfunction carriesBadSignature(sent: Uint8Array): boolean | undefined {\n if (sent.length > MAX_TRANSACTION_SIZE) return undefined;\n const tx = parseSignedTransaction(sent);\n if (!tx) return undefined;\n return tx.signatures.some(\n (signature, i) =>\n !ed25519Scheme.verify({\n publicKey: tx.parts.keys[i] as Uint8Array,\n payload: tx.message,\n signature,\n }),\n );\n}\n\n/**\n * The node's answer to `sent`, the bytes this driver sent. A `rejected` stands\n * only when `sent` carries a signature that does not verify; otherwise the answer is\n * `refused`. Every other answer is the node's, as `classifyBroadcastError` reads it.\n */\nexport function classifyOwnBroadcast(\n sent: Uint8Array,\n code: number | undefined,\n message: string,\n data?: unknown,\n): BroadcastResult {\n const result = classifyBroadcastError(code, message, data);\n if (result.kind !== 'rejected') return result;\n return carriesBadSignature(sent) === true ? result : CLAIMED_INVALID_SIGNATURE;\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Solana fee policy (base fee plus priority), pure and bigint-only. The
|
|
3
|
+
* priority fee is `ceil(computeUnitPrice × computeUnitLimit / 1_000_000)` lamports, charged
|
|
4
|
+
* on the requested limit (Solana's fee documentation).
|
|
5
|
+
*/
|
|
6
|
+
import { ValidationError } from '../../core/errors/error';
|
|
7
|
+
import type { FeeEstimateDraft, FeeOverride, FeeSpeed } from '../../core/model/fee';
|
|
8
|
+
import type { SolanaFeeDetails, SolanaFeeOverride } from './types';
|
|
9
|
+
/** Library policy: the percentile of recent prioritization fees each speed pays. */
|
|
10
|
+
export declare const SPEED_PERCENTILE: Readonly<Record<FeeSpeed, number>>;
|
|
11
|
+
/** Library policy: the compute-unit limit is the simulated usage plus 20% and 1,000 units. */
|
|
12
|
+
export declare function computeUnitLimitFor(unitsConsumed: bigint): bigint;
|
|
13
|
+
/** The runtime's own default when a simulation cannot measure the transaction. */
|
|
14
|
+
export declare function fallbackComputeUnitLimit(instructions: number): bigint;
|
|
15
|
+
/**
|
|
16
|
+
* Build variants: identical intents built on the same blockhash would
|
|
17
|
+
* sign byte-identical messages, so a second Operation would silently share the first one's
|
|
18
|
+
* signature and one payment would be lost. Each estimate therefore adds a variant to the
|
|
19
|
+
* compute-unit limit (0 to 1,023 units) and, for a speed, to the price (0 to 999
|
|
20
|
+
* micro-lamports): at most about one lamport of priority fee per 1,000 compute units.
|
|
21
|
+
*/
|
|
22
|
+
export declare const VARIANTS: number;
|
|
23
|
+
export declare function variantOffsets(variant: number): {
|
|
24
|
+
readonly limit: bigint;
|
|
25
|
+
readonly price: bigint;
|
|
26
|
+
};
|
|
27
|
+
/** The largest price variant a speed adds, in micro-lamports per compute unit. */
|
|
28
|
+
export declare const MAX_PRICE_VARIANT = 999n;
|
|
29
|
+
/**
|
|
30
|
+
* A speed's signed price within the handle's `maxComputeUnitPrice`: the node's
|
|
31
|
+
* percentile, at most the bound less the largest variant, plus this build's variant. The
|
|
32
|
+
* signed price never exceeds the bound, and identical transfers still differ at it.
|
|
33
|
+
* The bound is at least `MAX_PRICE_VARIANT` (`solanaNetworkConfig`).
|
|
34
|
+
*/
|
|
35
|
+
export declare function speedPrice(percentile: bigint, variant: bigint, maxComputeUnitPrice: bigint): bigint;
|
|
36
|
+
/**
|
|
37
|
+
* An explicit price above the handle's bound, refused before anything is signed. The details
|
|
38
|
+
* carry the price and the bound (decimal strings), so the caller sees what to allow.
|
|
39
|
+
*/
|
|
40
|
+
export declare function aboveMaxPrice(price: bigint, maxComputeUnitPrice: bigint): ValidationError;
|
|
41
|
+
/** A per-driver counter from a random start: distinct in-process, rare across processes. */
|
|
42
|
+
export declare function variantCounter(start: number): () => number;
|
|
43
|
+
export declare function priorityFee(computeUnitPrice: bigint, computeUnitLimit: bigint): bigint;
|
|
44
|
+
/**
|
|
45
|
+
* The nearest-rank percentile of `getRecentPrioritizationFees` answers (micro-lamports per
|
|
46
|
+
* compute unit); `0n` when the node reports none. A malformed entry, including one outside
|
|
47
|
+
* the u64 range or without room for the price variant, is a retryable
|
|
48
|
+
* `PROVIDER_UNAVAILABLE`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function priceForSpeed(recent: unknown, speed: FeeSpeed): bigint;
|
|
51
|
+
/** A validated `SolanaFeeOverride`; anything else is `INVALID_INTENT`. */
|
|
52
|
+
export declare function parseOverride(fee: FeeOverride): SolanaFeeOverride;
|
|
53
|
+
/**
|
|
54
|
+
* The fee draft: `network` (the signature fee), `priority` and, when the recipient's token
|
|
55
|
+
* account is created, `rent`. The bound is `exact` unless rent is charged: that deposit is
|
|
56
|
+
* skipped when someone else creates the account first, so it is an upper bound.
|
|
57
|
+
*/
|
|
58
|
+
export declare function feeDraft(speed: FeeSpeed | 'custom', details: SolanaFeeDetails): FeeEstimateDraft;
|
|
59
|
+
/** The `SolanaFeeDetails` of a draft this driver made; anything else is `INVALID_INTENT`. */
|
|
60
|
+
export declare function detailsOf(fee: FeeEstimateDraft): SolanaFeeDetails;
|
|
61
|
+
/**
|
|
62
|
+
* The compute budget `build` signs, checked wherever the estimate
|
|
63
|
+
* came from (the store, `prepareTransfer`, a caller): the price within the handle's bound,
|
|
64
|
+
* the limit within the protocol's, and the priority fee exactly the one that budget costs.
|
|
65
|
+
*/
|
|
66
|
+
export declare function signedFee(fee: FeeEstimateDraft, maxComputeUnitPrice: bigint): SolanaFeeDetails;
|
|
67
|
+
/** The lamports every fee charge of `fee` adds up to. */
|
|
68
|
+
export declare const lamportsCharged: (fee: FeeEstimateDraft) => bigint;
|