crypto-aio 0.0.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +167 -0
- package/README.md +163 -13
- package/dist/adapters/avalanche/address.d.ts +15 -0
- package/dist/adapters/avalanche/address.js +74 -0
- package/dist/adapters/avalanche/address.js.map +1 -0
- package/dist/adapters/avalanche/api.d.ts +100 -0
- package/dist/adapters/avalanche/api.js +381 -0
- package/dist/adapters/avalanche/api.js.map +1 -0
- package/dist/adapters/avalanche/builder.d.ts +13 -0
- package/dist/adapters/avalanche/builder.js +336 -0
- package/dist/adapters/avalanche/builder.js.map +1 -0
- package/dist/adapters/avalanche/cb58.d.ts +7 -0
- package/dist/adapters/avalanche/cb58.js +49 -0
- package/dist/adapters/avalanche/cb58.js.map +1 -0
- package/dist/adapters/avalanche/chains.d.ts +21 -0
- package/dist/adapters/avalanche/chains.js +79 -0
- package/dist/adapters/avalanche/chains.js.map +1 -0
- package/dist/adapters/avalanche/codec.d.ts +94 -0
- package/dist/adapters/avalanche/codec.js +371 -0
- package/dist/adapters/avalanche/codec.js.map +1 -0
- package/dist/adapters/avalanche/context.d.ts +59 -0
- package/dist/adapters/avalanche/context.js +114 -0
- package/dist/adapters/avalanche/context.js.map +1 -0
- package/dist/adapters/avalanche/decode.d.ts +16 -0
- package/dist/adapters/avalanche/decode.js +101 -0
- package/dist/adapters/avalanche/decode.js.map +1 -0
- package/dist/adapters/avalanche/driver.d.ts +22 -0
- package/dist/adapters/avalanche/driver.js +81 -0
- package/dist/adapters/avalanche/driver.js.map +1 -0
- package/dist/adapters/avalanche/errors.d.ts +18 -0
- package/dist/adapters/avalanche/errors.js +61 -0
- package/dist/adapters/avalanche/errors.js.map +1 -0
- package/dist/adapters/avalanche/fees.d.ts +23 -0
- package/dist/adapters/avalanche/fees.js +105 -0
- package/dist/adapters/avalanche/fees.js.map +1 -0
- package/dist/adapters/avalanche/index.d.ts +19 -0
- package/dist/adapters/avalanche/index.js +8 -0
- package/dist/adapters/avalanche/index.js.map +1 -0
- package/dist/adapters/avalanche/network.d.ts +37 -0
- package/dist/adapters/avalanche/network.js +135 -0
- package/dist/adapters/avalanche/network.js.map +1 -0
- package/dist/adapters/avalanche/plugin.d.ts +21 -0
- package/dist/adapters/avalanche/plugin.js +46 -0
- package/dist/adapters/avalanche/plugin.js.map +1 -0
- package/dist/adapters/avalanche/presets.d.ts +6 -0
- package/dist/adapters/avalanche/presets.js +86 -0
- package/dist/adapters/avalanche/presets.js.map +1 -0
- package/dist/adapters/avalanche/proofs.d.ts +41 -0
- package/dist/adapters/avalanche/proofs.js +270 -0
- package/dist/adapters/avalanche/proofs.js.map +1 -0
- package/dist/adapters/avalanche/reader.d.ts +40 -0
- package/dist/adapters/avalanche/reader.js +231 -0
- package/dist/adapters/avalanche/reader.js.map +1 -0
- package/dist/adapters/avalanche/sdk.d.ts +182 -0
- package/dist/adapters/avalanche/sdk.js +21 -0
- package/dist/adapters/avalanche/sdk.js.map +1 -0
- package/dist/adapters/avalanche/types.d.ts +86 -0
- package/dist/{type/common.js → adapters/avalanche/types.js} +1 -1
- package/dist/adapters/avalanche/types.js.map +1 -0
- package/dist/adapters/evm/builder.d.ts +11 -0
- package/dist/adapters/evm/builder.js +386 -0
- package/dist/adapters/evm/builder.js.map +1 -0
- package/dist/adapters/evm/chains.d.ts +6 -0
- package/dist/adapters/evm/chains.js +203 -0
- package/dist/adapters/evm/chains.js.map +1 -0
- package/dist/adapters/evm/client.d.ts +84 -0
- package/dist/adapters/evm/client.js +335 -0
- package/dist/adapters/evm/client.js.map +1 -0
- package/dist/adapters/evm/decode.d.ts +35 -0
- package/dist/adapters/evm/decode.js +175 -0
- package/dist/adapters/evm/decode.js.map +1 -0
- package/dist/adapters/evm/driver.d.ts +8 -0
- package/dist/adapters/evm/driver.js +61 -0
- package/dist/adapters/evm/driver.js.map +1 -0
- package/dist/adapters/evm/errors.d.ts +20 -0
- package/dist/adapters/evm/errors.js +110 -0
- package/dist/adapters/evm/errors.js.map +1 -0
- package/dist/adapters/evm/ethers-client.d.ts +43 -0
- package/dist/adapters/evm/ethers-client.js +139 -0
- package/dist/adapters/evm/ethers-client.js.map +1 -0
- package/dist/adapters/evm/fees.d.ts +103 -0
- package/dist/adapters/evm/fees.js +277 -0
- package/dist/adapters/evm/fees.js.map +1 -0
- package/dist/adapters/evm/index.d.ts +20 -0
- package/dist/adapters/evm/index.js +12 -0
- package/dist/adapters/evm/index.js.map +1 -0
- package/dist/adapters/evm/network.d.ts +65 -0
- package/dist/adapters/evm/network.js +150 -0
- package/dist/adapters/evm/network.js.map +1 -0
- package/dist/adapters/evm/plugin.d.ts +35 -0
- package/dist/adapters/evm/plugin.js +150 -0
- package/dist/adapters/evm/plugin.js.map +1 -0
- package/dist/adapters/evm/presets.d.ts +2 -0
- package/dist/adapters/evm/presets.js +105 -0
- package/dist/adapters/evm/presets.js.map +1 -0
- package/dist/adapters/evm/proofs.d.ts +19 -0
- package/dist/adapters/evm/proofs.js +370 -0
- package/dist/adapters/evm/proofs.js.map +1 -0
- package/dist/adapters/evm/rawtx.d.ts +25 -0
- package/dist/adapters/evm/rawtx.js +176 -0
- package/dist/adapters/evm/rawtx.js.map +1 -0
- package/dist/adapters/evm/reader.d.ts +83 -0
- package/dist/adapters/evm/reader.js +326 -0
- package/dist/adapters/evm/reader.js.map +1 -0
- package/dist/adapters/evm/rpc.d.ts +39 -0
- package/dist/adapters/evm/rpc.js +152 -0
- package/dist/adapters/evm/rpc.js.map +1 -0
- package/dist/adapters/evm/tokens.d.ts +10 -0
- package/dist/adapters/evm/tokens.js +23 -0
- package/dist/adapters/evm/tokens.js.map +1 -0
- package/dist/adapters/evm/types.d.ts +265 -0
- package/dist/{type/account.js → adapters/evm/types.js} +1 -1
- package/dist/adapters/evm/types.js.map +1 -0
- package/dist/adapters/evm/web3-client.d.ts +26 -0
- package/dist/adapters/evm/web3-client.js +176 -0
- package/dist/adapters/evm/web3-client.js.map +1 -0
- package/dist/adapters/solana/builder.d.ts +18 -0
- package/dist/adapters/solana/builder.js +556 -0
- package/dist/adapters/solana/builder.js.map +1 -0
- package/dist/adapters/solana/chains.d.ts +13 -0
- package/dist/adapters/solana/chains.js +37 -0
- package/dist/adapters/solana/chains.js.map +1 -0
- package/dist/adapters/solana/decode.d.ts +111 -0
- package/dist/adapters/solana/decode.js +595 -0
- package/dist/adapters/solana/decode.js.map +1 -0
- package/dist/adapters/solana/driver.d.ts +15 -0
- package/dist/adapters/solana/driver.js +72 -0
- package/dist/adapters/solana/driver.js.map +1 -0
- package/dist/adapters/solana/errors.d.ts +36 -0
- package/dist/adapters/solana/errors.js +154 -0
- package/dist/adapters/solana/errors.js.map +1 -0
- package/dist/adapters/solana/fees.d.ts +77 -0
- package/dist/adapters/solana/fees.js +214 -0
- package/dist/adapters/solana/fees.js.map +1 -0
- package/dist/adapters/solana/heights.d.ts +47 -0
- package/dist/adapters/solana/heights.js +185 -0
- package/dist/adapters/solana/heights.js.map +1 -0
- package/dist/adapters/solana/history.d.ts +10 -0
- package/dist/adapters/solana/history.js +71 -0
- package/dist/adapters/solana/history.js.map +1 -0
- package/dist/adapters/solana/index.d.ts +16 -0
- package/dist/adapters/solana/index.js +9 -0
- package/dist/adapters/solana/index.js.map +1 -0
- package/dist/adapters/solana/keys.d.ts +13 -0
- package/dist/adapters/solana/keys.js +69 -0
- package/dist/adapters/solana/keys.js.map +1 -0
- package/dist/adapters/solana/message.d.ts +15 -0
- package/dist/adapters/solana/message.js +120 -0
- package/dist/adapters/solana/message.js.map +1 -0
- package/dist/adapters/solana/network.d.ts +24 -0
- package/dist/adapters/solana/network.js +95 -0
- package/dist/adapters/solana/network.js.map +1 -0
- package/dist/adapters/solana/plugin.d.ts +18 -0
- package/dist/adapters/solana/plugin.js +44 -0
- package/dist/adapters/solana/plugin.js.map +1 -0
- package/dist/adapters/solana/presets.d.ts +2 -0
- package/dist/adapters/solana/presets.js +77 -0
- package/dist/adapters/solana/presets.js.map +1 -0
- package/dist/adapters/solana/programs.d.ts +44 -0
- package/dist/adapters/solana/programs.js +159 -0
- package/dist/adapters/solana/programs.js.map +1 -0
- package/dist/adapters/solana/proofs.d.ts +56 -0
- package/dist/adapters/solana/proofs.js +540 -0
- package/dist/adapters/solana/proofs.js.map +1 -0
- package/dist/adapters/solana/reader.d.ts +82 -0
- package/dist/adapters/solana/reader.js +326 -0
- package/dist/adapters/solana/reader.js.map +1 -0
- package/dist/adapters/solana/rpc.d.ts +102 -0
- package/dist/adapters/solana/rpc.js +301 -0
- package/dist/adapters/solana/rpc.js.map +1 -0
- package/dist/adapters/solana/tokens.d.ts +7 -0
- package/dist/adapters/solana/tokens.js +19 -0
- package/dist/adapters/solana/tokens.js.map +1 -0
- package/dist/adapters/solana/types.d.ts +124 -0
- package/dist/{type/contract.js → adapters/solana/types.js} +1 -1
- package/dist/adapters/solana/types.js.map +1 -0
- package/dist/adapters/solana/web3.d.ts +5 -0
- package/dist/adapters/solana/web3.js +61 -0
- package/dist/adapters/solana/web3.js.map +1 -0
- package/dist/adapters/solana/wire.d.ts +62 -0
- package/dist/adapters/solana/wire.js +168 -0
- package/dist/adapters/solana/wire.js.map +1 -0
- package/dist/adapters/ton/address.d.ts +43 -0
- package/dist/adapters/ton/address.js +168 -0
- package/dist/adapters/ton/address.js.map +1 -0
- package/dist/adapters/ton/api.d.ts +344 -0
- package/dist/adapters/ton/api.js +942 -0
- package/dist/adapters/ton/api.js.map +1 -0
- package/dist/adapters/ton/builder.d.ts +18 -0
- package/dist/adapters/ton/builder.js +701 -0
- package/dist/adapters/ton/builder.js.map +1 -0
- package/dist/adapters/ton/chains.d.ts +16 -0
- package/dist/adapters/ton/chains.js +39 -0
- package/dist/adapters/ton/chains.js.map +1 -0
- package/dist/adapters/ton/decode.d.ts +43 -0
- package/dist/adapters/ton/decode.js +219 -0
- package/dist/adapters/ton/decode.js.map +1 -0
- package/dist/adapters/ton/driver.d.ts +10 -0
- package/dist/adapters/ton/driver.js +117 -0
- package/dist/adapters/ton/driver.js.map +1 -0
- package/dist/adapters/ton/errors.d.ts +36 -0
- package/dist/adapters/ton/errors.js +89 -0
- package/dist/adapters/ton/errors.js.map +1 -0
- package/dist/adapters/ton/fees.d.ts +28 -0
- package/dist/adapters/ton/fees.js +121 -0
- package/dist/adapters/ton/fees.js.map +1 -0
- package/dist/adapters/ton/index.d.ts +16 -0
- package/dist/adapters/ton/index.js +9 -0
- package/dist/adapters/ton/index.js.map +1 -0
- package/dist/adapters/ton/messages.d.ts +157 -0
- package/dist/adapters/ton/messages.js +397 -0
- package/dist/adapters/ton/messages.js.map +1 -0
- package/dist/adapters/ton/native-client.d.ts +10 -0
- package/dist/adapters/ton/native-client.js +47 -0
- package/dist/adapters/ton/native-client.js.map +1 -0
- package/dist/adapters/ton/network.d.ts +58 -0
- package/dist/adapters/ton/network.js +207 -0
- package/dist/adapters/ton/network.js.map +1 -0
- package/dist/adapters/ton/plugin.d.ts +24 -0
- package/dist/adapters/ton/plugin.js +57 -0
- package/dist/adapters/ton/plugin.js.map +1 -0
- package/dist/adapters/ton/presets.d.ts +6 -0
- package/dist/adapters/ton/presets.js +94 -0
- package/dist/adapters/ton/presets.js.map +1 -0
- package/dist/adapters/ton/proofs.d.ts +66 -0
- package/dist/adapters/ton/proofs.js +755 -0
- package/dist/adapters/ton/proofs.js.map +1 -0
- package/dist/adapters/ton/reader.d.ts +235 -0
- package/dist/adapters/ton/reader.js +976 -0
- package/dist/adapters/ton/reader.js.map +1 -0
- package/dist/adapters/ton/tokens.d.ts +10 -0
- package/dist/adapters/ton/tokens.js +27 -0
- package/dist/adapters/ton/tokens.js.map +1 -0
- package/dist/adapters/ton/trace.d.ts +74 -0
- package/dist/adapters/ton/trace.js +303 -0
- package/dist/adapters/ton/trace.js.map +1 -0
- package/dist/adapters/ton/types.d.ts +105 -0
- package/dist/{type/transact.js → adapters/ton/types.js} +1 -1
- package/dist/adapters/ton/types.js.map +1 -0
- package/dist/adapters/ton/wallets.d.ts +86 -0
- package/dist/adapters/ton/wallets.js +373 -0
- package/dist/adapters/ton/wallets.js.map +1 -0
- package/dist/adapters/tron/abi.d.ts +41 -0
- package/dist/adapters/tron/abi.js +112 -0
- package/dist/adapters/tron/abi.js.map +1 -0
- package/dist/adapters/tron/address.d.ts +20 -0
- package/dist/adapters/tron/address.js +110 -0
- package/dist/adapters/tron/address.js.map +1 -0
- package/dist/adapters/tron/builder.d.ts +12 -0
- package/dist/adapters/tron/builder.js +569 -0
- package/dist/adapters/tron/builder.js.map +1 -0
- package/dist/adapters/tron/chains.d.ts +12 -0
- package/dist/adapters/tron/chains.js +35 -0
- package/dist/adapters/tron/chains.js.map +1 -0
- package/dist/adapters/tron/codec.d.ts +10 -0
- package/dist/adapters/tron/codec.js +322 -0
- package/dist/adapters/tron/codec.js.map +1 -0
- package/dist/adapters/tron/decode.d.ts +52 -0
- package/dist/adapters/tron/decode.js +280 -0
- package/dist/adapters/tron/decode.js.map +1 -0
- package/dist/adapters/tron/driver.d.ts +12 -0
- package/dist/adapters/tron/driver.js +106 -0
- package/dist/adapters/tron/driver.js.map +1 -0
- package/dist/adapters/tron/errors.d.ts +74 -0
- package/dist/adapters/tron/errors.js +261 -0
- package/dist/adapters/tron/errors.js.map +1 -0
- package/dist/adapters/tron/fees.d.ts +49 -0
- package/dist/adapters/tron/fees.js +166 -0
- package/dist/adapters/tron/fees.js.map +1 -0
- package/dist/adapters/tron/http.d.ts +173 -0
- package/dist/adapters/tron/http.js +729 -0
- package/dist/adapters/tron/http.js.map +1 -0
- package/dist/adapters/tron/index.d.ts +16 -0
- package/dist/adapters/tron/index.js +15 -0
- package/dist/adapters/tron/index.js.map +1 -0
- package/dist/adapters/tron/network.d.ts +44 -0
- package/dist/adapters/tron/network.js +163 -0
- package/dist/adapters/tron/network.js.map +1 -0
- package/dist/adapters/tron/plugin.d.ts +17 -0
- package/dist/adapters/tron/plugin.js +39 -0
- package/dist/adapters/tron/plugin.js.map +1 -0
- package/dist/adapters/tron/presets.d.ts +5 -0
- package/dist/adapters/tron/presets.js +68 -0
- package/dist/adapters/tron/presets.js.map +1 -0
- package/dist/adapters/tron/proofs.d.ts +80 -0
- package/dist/adapters/tron/proofs.js +371 -0
- package/dist/adapters/tron/proofs.js.map +1 -0
- package/dist/adapters/tron/protobuf.d.ts +36 -0
- package/dist/adapters/tron/protobuf.js +90 -0
- package/dist/adapters/tron/protobuf.js.map +1 -0
- package/dist/adapters/tron/reader.d.ts +57 -0
- package/dist/adapters/tron/reader.js +220 -0
- package/dist/adapters/tron/reader.js.map +1 -0
- package/dist/adapters/tron/tokens.d.ts +9 -0
- package/dist/adapters/tron/tokens.js +14 -0
- package/dist/adapters/tron/tokens.js.map +1 -0
- package/dist/adapters/tron/types.d.ts +166 -0
- package/dist/adapters/tron/types.js +3 -0
- package/dist/adapters/tron/types.js.map +1 -0
- package/dist/adapters/utxo/address.d.ts +51 -0
- package/dist/adapters/utxo/address.js +341 -0
- package/dist/adapters/utxo/address.js.map +1 -0
- package/dist/adapters/utxo/builder.d.ts +35 -0
- package/dist/adapters/utxo/builder.js +380 -0
- package/dist/adapters/utxo/builder.js.map +1 -0
- package/dist/adapters/utxo/chains.d.ts +17 -0
- package/dist/adapters/utxo/chains.js +100 -0
- package/dist/adapters/utxo/chains.js.map +1 -0
- package/dist/adapters/utxo/codec.d.ts +120 -0
- package/dist/adapters/utxo/codec.js +408 -0
- package/dist/adapters/utxo/codec.js.map +1 -0
- package/dist/adapters/utxo/coinselect.d.ts +48 -0
- package/dist/adapters/utxo/coinselect.js +131 -0
- package/dist/adapters/utxo/coinselect.js.map +1 -0
- package/dist/adapters/utxo/context.d.ts +63 -0
- package/dist/adapters/utxo/context.js +125 -0
- package/dist/adapters/utxo/context.js.map +1 -0
- package/dist/adapters/utxo/decode.d.ts +22 -0
- package/dist/adapters/utxo/decode.js +121 -0
- package/dist/adapters/utxo/decode.js.map +1 -0
- package/dist/adapters/utxo/driver.d.ts +16 -0
- package/dist/adapters/utxo/driver.js +79 -0
- package/dist/adapters/utxo/driver.js.map +1 -0
- package/dist/adapters/utxo/ecc.d.ts +9 -0
- package/dist/adapters/utxo/ecc.js +26 -0
- package/dist/adapters/utxo/ecc.js.map +1 -0
- package/dist/adapters/utxo/errors.d.ts +52 -0
- package/dist/adapters/utxo/errors.js +191 -0
- package/dist/adapters/utxo/errors.js.map +1 -0
- package/dist/adapters/utxo/esplora.d.ts +100 -0
- package/dist/adapters/utxo/esplora.js +498 -0
- package/dist/adapters/utxo/esplora.js.map +1 -0
- package/dist/adapters/utxo/fees.d.ts +41 -0
- package/dist/adapters/utxo/fees.js +125 -0
- package/dist/adapters/utxo/fees.js.map +1 -0
- package/dist/adapters/utxo/index.d.ts +17 -0
- package/dist/adapters/utxo/index.js +8 -0
- package/dist/adapters/utxo/index.js.map +1 -0
- package/dist/adapters/utxo/network.d.ts +50 -0
- package/dist/adapters/utxo/network.js +165 -0
- package/dist/adapters/utxo/network.js.map +1 -0
- package/dist/adapters/utxo/plugin.d.ts +17 -0
- package/dist/adapters/utxo/plugin.js +41 -0
- package/dist/adapters/utxo/plugin.js.map +1 -0
- package/dist/adapters/utxo/presets.d.ts +12 -0
- package/dist/adapters/utxo/presets.js +47 -0
- package/dist/adapters/utxo/presets.js.map +1 -0
- package/dist/adapters/utxo/preview.d.ts +3 -0
- package/dist/adapters/utxo/preview.js +65 -0
- package/dist/adapters/utxo/preview.js.map +1 -0
- package/dist/adapters/utxo/proofs.d.ts +66 -0
- package/dist/adapters/utxo/proofs.js +469 -0
- package/dist/adapters/utxo/proofs.js.map +1 -0
- package/dist/adapters/utxo/rawblock.d.ts +46 -0
- package/dist/adapters/utxo/rawblock.js +159 -0
- package/dist/adapters/utxo/rawblock.js.map +1 -0
- package/dist/adapters/utxo/rawtx.d.ts +73 -0
- package/dist/adapters/utxo/rawtx.js +264 -0
- package/dist/adapters/utxo/rawtx.js.map +1 -0
- package/dist/adapters/utxo/reader.d.ts +36 -0
- package/dist/adapters/utxo/reader.js +265 -0
- package/dist/adapters/utxo/reader.js.map +1 -0
- package/dist/adapters/utxo/sdk.d.ts +18 -0
- package/dist/adapters/utxo/sdk.js +17 -0
- package/dist/adapters/utxo/sdk.js.map +1 -0
- package/dist/adapters/utxo/signed-psbt.d.ts +36 -0
- package/dist/adapters/utxo/signed-psbt.js +428 -0
- package/dist/adapters/utxo/signed-psbt.js.map +1 -0
- package/dist/adapters/utxo/spend.d.ts +59 -0
- package/dist/adapters/utxo/spend.js +230 -0
- package/dist/adapters/utxo/spend.js.map +1 -0
- package/dist/adapters/utxo/types.d.ts +167 -0
- package/dist/adapters/utxo/types.js +3 -0
- package/dist/adapters/utxo/types.js.map +1 -0
- package/dist/core/assets/service.d.ts +18 -0
- package/dist/core/assets/service.js +69 -0
- package/dist/core/assets/service.js.map +1 -0
- package/dist/core/blockchain/default-ref.d.ts +4 -0
- package/dist/core/blockchain/default-ref.js +16 -0
- package/dist/core/blockchain/default-ref.js.map +1 -0
- package/dist/core/blockchain/handle.d.ts +179 -0
- package/dist/core/blockchain/handle.js +579 -0
- package/dist/core/blockchain/handle.js.map +1 -0
- package/dist/core/blockchain/internal.d.ts +19 -0
- package/dist/core/blockchain/internal.js +16 -0
- package/dist/core/blockchain/internal.js.map +1 -0
- package/dist/core/blockchain/mapping.d.ts +22 -0
- package/dist/core/blockchain/mapping.js +136 -0
- package/dist/core/blockchain/mapping.js.map +1 -0
- package/dist/core/config/env.d.ts +8 -0
- package/dist/core/config/env.js +60 -0
- package/dist/core/config/env.js.map +1 -0
- package/dist/core/config/merge.d.ts +26 -0
- package/dist/core/config/merge.js +144 -0
- package/dist/core/config/merge.js.map +1 -0
- package/dist/core/config/resolve.d.ts +12 -0
- package/dist/core/config/resolve.js +251 -0
- package/dist/core/config/resolve.js.map +1 -0
- package/dist/core/config/types.d.ts +180 -0
- package/dist/core/config/types.js +3 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/container/builtins.d.ts +4 -0
- package/dist/core/container/builtins.js +13 -0
- package/dist/core/container/builtins.js.map +1 -0
- package/dist/core/container/container.d.ts +62 -0
- package/dist/core/container/container.js +500 -0
- package/dist/core/container/container.js.map +1 -0
- package/dist/core/container/default.d.ts +15 -0
- package/dist/core/container/default.js +70 -0
- package/dist/core/container/default.js.map +1 -0
- package/dist/core/container/internals.d.ts +54 -0
- package/dist/core/container/internals.js +21 -0
- package/dist/core/container/internals.js.map +1 -0
- package/dist/core/container/pool.d.ts +27 -0
- package/dist/core/container/pool.js +77 -0
- package/dist/core/container/pool.js.map +1 -0
- package/dist/core/driver/types.d.ts +379 -0
- package/dist/core/driver/types.js +3 -0
- package/dist/core/driver/types.js.map +1 -0
- package/dist/core/errors/codes.d.ts +163 -0
- package/dist/core/errors/codes.js +53 -0
- package/dist/core/errors/codes.js.map +1 -0
- package/dist/core/errors/error.d.ts +66 -0
- package/dist/core/errors/error.js +129 -0
- package/dist/core/errors/error.js.map +1 -0
- package/dist/core/events/bus.d.ts +12 -0
- package/dist/core/events/bus.js +46 -0
- package/dist/core/events/bus.js.map +1 -0
- package/dist/core/events/logger.d.ts +13 -0
- package/dist/core/events/logger.js +42 -0
- package/dist/core/events/logger.js.map +1 -0
- package/dist/core/events/types.d.ts +131 -0
- package/dist/core/events/types.js +3 -0
- package/dist/core/events/types.js.map +1 -0
- package/dist/core/lifecycle/engine-rules.d.ts +106 -0
- package/dist/core/lifecycle/engine-rules.js +267 -0
- package/dist/core/lifecycle/engine-rules.js.map +1 -0
- package/dist/core/lifecycle/engine.d.ts +502 -0
- package/dist/core/lifecycle/engine.js +1750 -0
- package/dist/core/lifecycle/engine.js.map +1 -0
- package/dist/core/lifecycle/evaluate.d.ts +19 -0
- package/dist/core/lifecycle/evaluate.js +77 -0
- package/dist/core/lifecycle/evaluate.js.map +1 -0
- package/dist/core/lifecycle/intent.d.ts +11 -0
- package/dist/core/lifecycle/intent.js +88 -0
- package/dist/core/lifecycle/intent.js.map +1 -0
- package/dist/core/lifecycle/monitor.d.ts +138 -0
- package/dist/core/lifecycle/monitor.js +616 -0
- package/dist/core/lifecycle/monitor.js.map +1 -0
- package/dist/core/lifecycle/observations.d.ts +17 -0
- package/dist/core/lifecycle/observations.js +59 -0
- package/dist/core/lifecycle/observations.js.map +1 -0
- package/dist/core/lifecycle/reconcile.d.ts +58 -0
- package/dist/core/lifecycle/reconcile.js +112 -0
- package/dist/core/lifecycle/reconcile.js.map +1 -0
- package/dist/core/lifecycle/views.d.ts +49 -0
- package/dist/core/lifecycle/views.js +57 -0
- package/dist/core/lifecycle/views.js.map +1 -0
- package/dist/core/lifecycle/workers.d.ts +88 -0
- package/dist/core/lifecycle/workers.js +347 -0
- package/dist/core/lifecycle/workers.js.map +1 -0
- package/dist/core/model/address.d.ts +32 -0
- package/dist/core/model/address.js +43 -0
- package/dist/core/model/address.js.map +1 -0
- package/dist/core/model/amount.d.ts +25 -0
- package/dist/core/model/amount.js +102 -0
- package/dist/core/model/amount.js.map +1 -0
- package/dist/core/model/asset.d.ts +28 -0
- package/dist/core/model/asset.js +47 -0
- package/dist/core/model/asset.js.map +1 -0
- package/dist/core/model/capability.d.ts +3 -0
- package/dist/core/model/capability.js +18 -0
- package/dist/core/model/capability.js.map +1 -0
- package/dist/core/model/chain.d.ts +63 -0
- package/dist/core/model/chain.js +8 -0
- package/dist/core/model/chain.js.map +1 -0
- package/dist/core/model/fee.d.ts +36 -0
- package/dist/core/model/fee.js +17 -0
- package/dist/core/model/fee.js.map +1 -0
- package/dist/core/model/ids.d.ts +38 -0
- package/dist/core/model/ids.js +14 -0
- package/dist/core/model/ids.js.map +1 -0
- package/dist/core/model/intent.d.ts +63 -0
- package/dist/core/model/intent.js +81 -0
- package/dist/core/model/intent.js.map +1 -0
- package/dist/core/model/ordering.d.ts +28 -0
- package/dist/core/model/ordering.js +29 -0
- package/dist/core/model/ordering.js.map +1 -0
- package/dist/core/model/transaction.d.ts +123 -0
- package/dist/{type/lib-types.js → core/model/transaction.js} +1 -1
- package/dist/core/model/transaction.js.map +1 -0
- package/dist/core/observe/scanner.d.ts +135 -0
- package/dist/core/observe/scanner.js +358 -0
- package/dist/core/observe/scanner.js.map +1 -0
- package/dist/core/ordering/reservations.d.ts +16 -0
- package/dist/core/ordering/reservations.js +53 -0
- package/dist/core/ordering/reservations.js.map +1 -0
- package/dist/core/ordering/sequence.d.ts +61 -0
- package/dist/core/ordering/sequence.js +155 -0
- package/dist/core/ordering/sequence.js.map +1 -0
- package/dist/core/registry/adapters.d.ts +10 -0
- package/dist/core/registry/adapters.js +56 -0
- package/dist/core/registry/adapters.js.map +1 -0
- package/dist/core/registry/assets.d.ts +18 -0
- package/dist/core/registry/assets.js +90 -0
- package/dist/core/registry/assets.js.map +1 -0
- package/dist/core/registry/chains.d.ts +10 -0
- package/dist/core/registry/chains.js +80 -0
- package/dist/core/registry/chains.js.map +1 -0
- package/dist/core/registry/plugin.d.ts +41 -0
- package/dist/core/registry/plugin.js +109 -0
- package/dist/core/registry/plugin.js.map +1 -0
- package/dist/core/registry/providers.d.ts +31 -0
- package/dist/core/registry/providers.js +43 -0
- package/dist/core/registry/providers.js.map +1 -0
- package/dist/core/registry/schemes.d.ts +30 -0
- package/dist/core/registry/schemes.js +84 -0
- package/dist/core/registry/schemes.js.map +1 -0
- package/dist/core/secret/fragments.d.ts +33 -0
- package/dist/core/secret/fragments.js +110 -0
- package/dist/core/secret/fragments.js.map +1 -0
- package/dist/core/secret/redact.d.ts +10 -0
- package/dist/core/secret/redact.js +110 -0
- package/dist/core/secret/redact.js.map +1 -0
- package/dist/core/secret/secret.d.ts +14 -0
- package/dist/core/secret/secret.js +42 -0
- package/dist/core/secret/secret.js.map +1 -0
- package/dist/core/signing/callback.d.ts +10 -0
- package/dist/core/signing/callback.js +22 -0
- package/dist/core/signing/callback.js.map +1 -0
- package/dist/core/signing/guard.d.ts +18 -0
- package/dist/core/signing/guard.js +72 -0
- package/dist/core/signing/guard.js.map +1 -0
- package/dist/core/signing/hd.d.ts +36 -0
- package/dist/core/signing/hd.js +167 -0
- package/dist/core/signing/hd.js.map +1 -0
- package/dist/core/signing/local.d.ts +48 -0
- package/dist/core/signing/local.js +190 -0
- package/dist/core/signing/local.js.map +1 -0
- package/dist/core/signing/orchestrator.d.ts +40 -0
- package/dist/core/signing/orchestrator.js +300 -0
- package/dist/core/signing/orchestrator.js.map +1 -0
- package/dist/core/signing/types.d.ts +64 -0
- package/dist/core/signing/types.js +3 -0
- package/dist/core/signing/types.js.map +1 -0
- package/dist/core/signing/wallet.d.ts +48 -0
- package/dist/core/signing/wallet.js +161 -0
- package/dist/core/signing/wallet.js.map +1 -0
- package/dist/core/store/clone.d.ts +25 -0
- package/dist/core/store/clone.js +71 -0
- package/dist/core/store/clone.js.map +1 -0
- package/dist/core/store/format.d.ts +20 -0
- package/dist/core/store/format.js +86 -0
- package/dist/core/store/format.js.map +1 -0
- package/dist/core/store/memory.d.ts +38 -0
- package/dist/core/store/memory.js +325 -0
- package/dist/core/store/memory.js.map +1 -0
- package/dist/core/store/types.d.ts +258 -0
- package/dist/core/store/types.js +119 -0
- package/dist/core/store/types.js.map +1 -0
- package/dist/core/transport/backoff.d.ts +8 -0
- package/dist/core/transport/backoff.js +27 -0
- package/dist/core/transport/backoff.js.map +1 -0
- package/dist/core/transport/circuit.d.ts +25 -0
- package/dist/core/transport/circuit.js +61 -0
- package/dist/core/transport/circuit.js.map +1 -0
- package/dist/core/transport/http-transport.d.ts +30 -0
- package/dist/core/transport/http-transport.js +1703 -0
- package/dist/core/transport/http-transport.js.map +1 -0
- package/dist/core/transport/rate-limit.d.ts +27 -0
- package/dist/core/transport/rate-limit.js +78 -0
- package/dist/core/transport/rate-limit.js.map +1 -0
- package/dist/core/transport/stale-view.d.ts +11 -0
- package/dist/core/transport/stale-view.js +17 -0
- package/dist/core/transport/stale-view.js.map +1 -0
- package/dist/core/transport/types.d.ts +159 -0
- package/dist/core/transport/types.js +6 -0
- package/dist/core/transport/types.js.map +1 -0
- package/dist/core/util/bytes.d.ts +9 -0
- package/dist/core/util/bytes.js +40 -0
- package/dist/core/util/bytes.js.map +1 -0
- package/dist/core/util/clock.d.ts +6 -0
- package/dist/core/util/clock.js +26 -0
- package/dist/core/util/clock.js.map +1 -0
- package/dist/core/util/freeze.d.ts +8 -0
- package/dist/core/util/freeze.js +31 -0
- package/dist/core/util/freeze.js.map +1 -0
- package/dist/core/util/json.d.ts +35 -0
- package/dist/core/util/json.js +174 -0
- package/dist/core/util/json.js.map +1 -0
- package/dist/core/util/names.d.ts +27 -0
- package/dist/core/util/names.js +56 -0
- package/dist/core/util/names.js.map +1 -0
- package/dist/index.d.ts +65 -14
- package/dist/index.js +107 -49
- package/dist/index.js.map +1 -1
- package/dist/native.d.ts +21 -0
- package/dist/native.js +44 -0
- package/dist/native.js.map +1 -0
- package/dist/testing/contracts/api.d.ts +12 -0
- package/dist/testing/contracts/api.js +58 -0
- package/dist/testing/contracts/api.js.map +1 -0
- package/dist/testing/contracts/cursors.d.ts +6 -0
- package/dist/testing/contracts/cursors.js +43 -0
- package/dist/testing/contracts/cursors.js.map +1 -0
- package/dist/testing/contracts/locks.d.ts +10 -0
- package/dist/testing/contracts/locks.js +63 -0
- package/dist/testing/contracts/locks.js.map +1 -0
- package/dist/testing/contracts/operations.d.ts +21 -0
- package/dist/testing/contracts/operations.js +737 -0
- package/dist/testing/contracts/operations.js.map +1 -0
- package/dist/testing/contracts/sequences.d.ts +6 -0
- package/dist/testing/contracts/sequences.js +68 -0
- package/dist/testing/contracts/sequences.js.map +1 -0
- package/dist/testing/env.d.ts +68 -0
- package/dist/testing/env.js +105 -0
- package/dist/testing/env.js.map +1 -0
- package/dist/testing/fake-chain.d.ts +118 -0
- package/dist/testing/fake-chain.js +536 -0
- package/dist/testing/fake-chain.js.map +1 -0
- package/dist/testing/fake-clock.d.ts +15 -0
- package/dist/testing/fake-clock.js +86 -0
- package/dist/testing/fake-clock.js.map +1 -0
- package/dist/testing/fake-driver.d.ts +15 -0
- package/dist/testing/fake-driver.js +458 -0
- package/dist/testing/fake-driver.js.map +1 -0
- package/dist/testing/fake-fetch.d.ts +32 -0
- package/dist/testing/fake-fetch.js +81 -0
- package/dist/testing/fake-fetch.js.map +1 -0
- package/dist/testing/fake-plugin.d.ts +30 -0
- package/dist/testing/fake-plugin.js +66 -0
- package/dist/testing/fake-plugin.js.map +1 -0
- package/dist/testing/faulty-store.d.ts +38 -0
- package/dist/testing/faulty-store.js +71 -0
- package/dist/testing/faulty-store.js.map +1 -0
- package/dist/testing/generation.d.ts +60 -0
- package/dist/testing/generation.js +252 -0
- package/dist/testing/generation.js.map +1 -0
- package/dist/testing/index.d.ts +28 -0
- package/dist/testing/index.js +51 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +198 -45
- package/dist/libs/eth/account.d.ts +0 -9
- package/dist/libs/eth/account.js +0 -58
- package/dist/libs/eth/account.js.map +0 -1
- package/dist/libs/eth/contract.d.ts +0 -7
- package/dist/libs/eth/contract.js +0 -42
- package/dist/libs/eth/contract.js.map +0 -1
- package/dist/libs/eth/index.d.ts +0 -24
- package/dist/libs/eth/index.js +0 -72
- package/dist/libs/eth/index.js.map +0 -1
- package/dist/libs/eth/transact.d.ts +0 -7
- package/dist/libs/eth/transact.js +0 -26
- package/dist/libs/eth/transact.js.map +0 -1
- package/dist/libs/index.d.ts +0 -2
- package/dist/libs/index.js +0 -19
- package/dist/libs/index.js.map +0 -1
- package/dist/libs/trx/account.d.ts +0 -9
- package/dist/libs/trx/account.js +0 -55
- package/dist/libs/trx/account.js.map +0 -1
- package/dist/libs/trx/contract.d.ts +0 -7
- package/dist/libs/trx/contract.js +0 -27
- package/dist/libs/trx/contract.js.map +0 -1
- package/dist/libs/trx/index.d.ts +0 -22
- package/dist/libs/trx/index.js +0 -64
- package/dist/libs/trx/index.js.map +0 -1
- package/dist/libs/trx/transact.d.ts +0 -7
- package/dist/libs/trx/transact.js +0 -26
- package/dist/libs/trx/transact.js.map +0 -1
- package/dist/tool/common.d.ts +0 -28
- package/dist/tool/common.js +0 -33
- package/dist/tool/common.js.map +0 -1
- package/dist/tool/eth-tools.d.ts +0 -3
- package/dist/tool/eth-tools.js +0 -33
- package/dist/tool/eth-tools.js.map +0 -1
- package/dist/tool/index.d.ts +0 -5
- package/dist/tool/index.js +0 -22
- package/dist/tool/index.js.map +0 -1
- package/dist/tool/logging.d.ts +0 -3
- package/dist/tool/logging.js +0 -11
- package/dist/tool/logging.js.map +0 -1
- package/dist/tool/options.d.ts +0 -6
- package/dist/tool/options.js +0 -41
- package/dist/tool/options.js.map +0 -1
- package/dist/tool/trx-tools.d.ts +0 -3
- package/dist/tool/trx-tools.js +0 -20
- package/dist/tool/trx-tools.js.map +0 -1
- package/dist/type/account.d.ts +0 -9
- package/dist/type/account.js.map +0 -1
- package/dist/type/common.d.ts +0 -18
- package/dist/type/common.js.map +0 -1
- package/dist/type/contract.d.ts +0 -10
- package/dist/type/contract.js.map +0 -1
- package/dist/type/index.d.ts +0 -5
- package/dist/type/index.js +0 -22
- package/dist/type/index.js.map +0 -1
- package/dist/type/lib-types.d.ts +0 -9
- package/dist/type/lib-types.js.map +0 -1
- package/dist/type/transact.d.ts +0 -7
- package/dist/type/transact.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../../src/adapters/ton/trace.ts"],"names":[],"mappings":";;;AA8IA,sCAQC;AAOD,oCAIC;AA0MD,wCA4BC;AAvYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,mDAAwD;AAGxD,qCAAiD;AACjD,yCAQoB;AACpB,uCAA2C;AAiD3C,qFAAqF;AACxE,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,YAAY,EAAE,+BAA+B;IAC7C,OAAO,EAAE,8BAA8B;IACvC,OAAO,EAAE,kBAAkB;IAC3B,aAAa,EAAE,yBAAyB;IACxC,gBAAgB,EAAE,yCAAyC;CAC5D,CAAC,CAAC;AAEH,MAAM,OAAO,GAAY,MAAM,CAAC,MAAM,CAA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C,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,MAAM,CAAC,eAAO,CAAC,YAAY,CAAC,CAAC;IAC1D,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,eAAO,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC9C,sFAAsF;IACtF,iBAAiB;IACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAC1E,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACnC,OAAO,MAAM,CACX,OAAO,CAAC,MAAM,EACd,MAAM,CAAC,MAAM,CAAC;gBACZ,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE;gBAC3B,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,GAAG,EAAE,OAAO,CAAC,GAAG;aACjB,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC","sourcesContent":["/**\n * The verdict on one of our own Attempts: did the value move? A TON wallet transaction\n * \"succeeds\" even when it moved nothing (send mode +2 skips a message it cannot pay), and\n * a transfer can still bounce, or a jetton move fail, one or two hops later. So an\n * Attempt succeeded only when:\n * - the wallet transaction consumed the request's seqno and ran it to the end;\n * - every message of the signed request is among its outgoing messages (a missing one is a\n * skip only when the wallet's action phase itself counts that many skipped actions);\n * - no native message came back bounced (a `nofunds` or `negfunds` bounce, a failed action\n * phase without send mode +16 and a non-bounceable message all leave the value with the\n * recipient), each delivery's bounce phase agreeing with the flag we signed;\n * - every jetton request reached a jetton wallet as an `internal_transfer` of a positive\n * amount from our wallet, sent by our jetton wallet and run to the end by the receiving\n * one (the exact amount is not required: fee-on-transfer tokens exist), and both jetton\n * wallets are the master's own for the sender and the intended recipient. That last\n * check needs chain reads, so the verdict returns the `legs` for the caller to confirm\n * (`confirmLegs` in `reader.ts`); the receiving wallet's own 707 check then holds.\n * A bounce read here is still only the indexer's word, and a lone lying indexer could\n * report one for a transfer that landed: so a bounce verdict returns where the chain\n * records it (`bounce`), for the caller to authenticate from the chain itself\n * (`confirmBounce` in `reader.ts`) before it decides anything.\n * Only a request that consumed its seqno is final: any other run (a failed action phase,\n * or a compute phase that failed before `commit()`) left the same message valid until it\n * expires, so anyone may replay it and move the value; such a run decides nothing\n * (`pending`), and only the seqno or the proven expiry can.\n * Used on the verdict paths only (`observe`, `includedFinal`). Every body read here is\n * bound to the hash the quorum keyed (`messageBody`). A batch is one Attempt: one bounced\n * output fails it, although the other outputs moved. Only the chain's own record of a\n * failure decides `failed`; an answer that contradicts the chain or the signed request (a\n * message missing that the wallet did not skip, a jetton wallet that ran the transfer yet\n * sent nothing from the sender, phases that contradict each other or the chain's own\n * counters) throws a retryable `PROVIDER_INCONSISTENT`, which decides nothing. Every\n * output is checked before any of them decides.\n */\nimport { ProviderError } from '../../core/errors/error';\nimport type { TxFailure } from '../../core/model/transaction';\nimport type { V3Message, V3Trace, V3Transaction } from './api';\nimport { ran, threwAfterCommit } from './decode';\nimport {\n OP,\n decodeComment,\n decodeJettonInternalTransfer,\n decodeJettonTransfer,\n decodeWalletRequest,\n messageBody,\n messageFacts,\n} from './messages';\nimport { externalHashOf } from './wallets';\n\n/** One jetton transfer: the jetton wallets whose owners must be `from` and `recipient`. */\nexport interface JettonLeg {\n readonly senderWallet: string;\n readonly recipientWallet: string;\n readonly recipient: string;\n}\n\n/** A transaction as the chain names it: its account (raw), logical time and hash (hex). */\nexport interface ChainTxId {\n readonly account: string;\n readonly lt: bigint;\n readonly hash: string;\n}\n\n/** A delivery on a bounce's path: its transaction and the hash of the message it received. */\nexport interface Delivery extends ChainTxId {\n readonly message: string;\n}\n\n/**\n * Where the chain records a bounce, as the indexer names it: our wallet transaction\n * (`root`), each delivery from its message on to the one that failed (`path`), and what\n * that last one did (`end`): sent the value back (its bounce phase), ran nothing, or ran\n * and moved no jettons. Names only: `confirmBounce` reads each from the chain.\n */\nexport interface BounceEvidence {\n readonly root: ChainTxId;\n readonly path: readonly Delivery[];\n readonly end: 'bounced' | 'unran' | 'unmoved';\n}\n\nexport type Verdict =\n | { readonly kind: 'success'; readonly legs: readonly JettonLeg[] }\n | {\n readonly kind: 'failed';\n readonly reason: string;\n /** Absent: the transfer did not happen (`reverted`). */\n readonly failure?: TxFailure;\n /** Every `bounced` and `jettonBounced` verdict carries its chain evidence. */\n readonly bounce?: BounceEvidence;\n }\n /**\n * Not decidable yet: the trace is still being executed or indexed, or the request ran\n * without consuming its seqno and may still run again until it expires.\n */\n | { readonly kind: 'pending' };\n\n/** Fixed reasons: a stored reason never holds an address, an amount or node text. */\nexport const REASONS = Object.freeze({\n walletFailed: 'the wallet transaction failed',\n skipped: 'the wallet skipped a message',\n bounced: 'transfer bounced',\n jettonBounced: 'jetton transfer bounced',\n jettonUnverified: 'the jetton wallets are not the master’s',\n});\n\nconst PENDING: Verdict = Object.freeze({ kind: 'pending' });\nconst failed = (reason: string, bounce?: BounceEvidence): Verdict =>\n Object.freeze({ kind: 'failed', reason, ...(bounce ? { bounce } : {}) });\n\nconst inconsistent = (reason: string) =>\n new ProviderError('PROVIDER_INCONSISTENT', reason, { retryable: true });\n\n/**\n * wallet_v5.fc: an external request whose send mode lacks +2, refused after `commit()`\n * stored the next seqno with an empty action list. The chain counts that compute phase a\n * success (transaction.cpp: `success = accepted && committed`) and runs the empty list, so\n * the transaction ran; the scripted node records it that way too. An indexer that wrote it\n * as a failed compute phase is still read as W5's refusal.\n */\nconst W5_REFUSED_AFTER_COMMIT = 137;\n\n/** Whether `tx` ran a W5 signed external request (only W5 throws 137 after committing). */\nfunction w5External(tx: V3Transaction): boolean {\n if (!tx.inMsg || tx.inMsg.source !== null) return false;\n const body = messageBody(tx.inMsg);\n return (\n body !== null &&\n body.bits.length >= 32 &&\n body.beginParse().preloadUint(32) === OP.w5SignedExternal\n );\n}\n\n/**\n * Whether the wallet transaction of an external request `tx` consumed the request's seqno,\n * so that the same message can never run again: it ran (the new seqno stands with the\n * actions, W5's 137 included), or, as a defensive reading of W5 alone, its compute phase is\n * recorded failed with 137. Any other run left the old seqno (transaction.cpp: a\n * failed action phase drops the compute phase's state, and a compute phase that failed\n * before `commit()` never had one): a foreign request signed with the same key, or our\n * own, whose action phase failed does not consume the seqno. Throws the retryable\n * contradiction of `ran`.\n */\nexport function consumesSeqno(tx: V3Transaction): boolean {\n if (ran(tx)) return true;\n return (\n !tx.compute.success &&\n !tx.compute.skipped &&\n tx.compute.exitCode === W5_REFUSED_AFTER_COMMIT &&\n w5External(tx)\n );\n}\n\n/**\n * Whether `tx` is our Attempt: the external message to `from` whose TEP-467 hash,\n * computed here from the bound body, is the Attempt id. The indexer's `hash_norm` only\n * finds candidates; it never decides.\n */\nexport function isOwnAttempt(tx: V3Transaction, from: string, refId: string): boolean {\n if (!tx.inMsg || tx.inMsg.source !== null || tx.account !== from) return false;\n const body = messageBody(tx.inMsg);\n return body !== null && externalHashOf(tx.account, body) === refId;\n}\n\n/**\n * The transaction in `trace` that received `message`, which `sender` sent. An internal\n * message is delivered once, to its destination, with its value and its bounce flag:\n * anything else contradicts the chain.\n */\nfunction receiver(trace: V3Trace, message: V3Message, sender: string): V3Transaction {\n const found = trace.transactions.filter((t) => t.inMsg?.hash === message.hash);\n const [tx] = found;\n if (!tx) throw inconsistent('a complete trace lacks a delivered message');\n if (\n found.length > 1 ||\n message.source !== sender ||\n tx.account !== message.destination ||\n tx.inMsg?.source !== sender ||\n tx.inMsg.value !== message.value ||\n (message.bounce !== null &&\n tx.inMsg.bounce !== null &&\n tx.inMsg.bounce !== message.bounce)\n ) {\n throw inconsistent('the trace delivered a message other than the one sent');\n }\n return tx;\n}\n\ninterface Sent {\n readonly out: V3Message;\n /** The bounce flag we signed for it: it decides whether a bounce phase may exist. */\n readonly bounceable: boolean;\n /** For a jetton request: its intended recipient (the owner). */\n readonly jettonRecipient?: string;\n}\n\n/** A native transfer as our builder signs it: a positive value, no body or a comment. */\nfunction plainTransfer(facts: NonNullable<ReturnType<typeof messageFacts>>): boolean {\n const { value, body } = facts;\n const empty = body.bits.length === 0 && body.refs.length === 0;\n return value > 0n && (empty || decodeComment(body) !== undefined);\n}\n\n/**\n * The requested messages, matched one to one with the wallet transaction's outgoing\n * messages; or why they did not all go out: the wallet skipped them (send mode +2), or its\n * code threw after committing the seqno. `ran` holds, so the outgoing messages are\n * distinct and as many as the action phase created; the skips must be exactly the missing\n * messages.\n */\nfunction sentMessages(root: V3Transaction): readonly Sent[] | 'skipped' | 'threw' {\n const body = messageBody(root.inMsg as V3Message);\n if (!body) throw inconsistent('the indexer has no body for the external message');\n const request = decodeWalletRequest(body);\n if (!request || request.auth !== 'external') {\n throw inconsistent('the indexed external message is not a wallet transfer');\n }\n const action = root.action as NonNullable<V3Transaction['action']>;\n // Committed, then threw (W5 137): the list committed with the seqno was empty.\n if (threwAfterCommit(root)) {\n if (action.msgsCreated !== 0 || action.skippedActions !== 0) {\n throw inconsistent('the wallet threw after committing, yet ran an action');\n }\n return 'threw';\n }\n const unused = [...root.outMsgs];\n const matched: Sent[] = [];\n let missing = 0;\n for (const requested of request.messages) {\n const facts = messageFacts(requested);\n if (!facts)\n throw inconsistent('the signed request holds a message that is not internal');\n // Our builder signs only plain transfers of a positive value and TEP-74 transfers; any\n // other message moves what the verdict cannot see, so it is never judged a success.\n const jetton = decodeJettonTransfer(facts.body);\n if (!jetton && !plainTransfer(facts)) {\n throw inconsistent('the signed request holds a message the verdict cannot judge');\n }\n const index = unused.findIndex(\n (out) =>\n out.destination === facts.to &&\n out.value === facts.value &&\n out.bodyHash === facts.bodyHash,\n );\n if (index < 0) {\n missing += 1;\n continue;\n }\n const out = unused.splice(index, 1)[0] as V3Message;\n // A message leaves the wallet with the flag we signed.\n const bounceable = requested.info.type === 'internal' && requested.info.bounce;\n if (out.bounce !== null && out.bounce !== bounceable) {\n throw inconsistent('a message went out with another bounce flag than signed');\n }\n matched.push({\n out,\n bounceable,\n ...(jetton ? { jettonRecipient: jetton.destination } : {}),\n });\n }\n if (unused.length > 0) {\n throw inconsistent(\n 'the wallet transaction sent a message the request did not ask for',\n );\n }\n // Send mode +2: the wallet records exactly the messages it skipped. The action phase\n // counts skipped sends since global version 8 (config param 8), which both networks\n // run; on an older chain this refuses (retryable), and never decides.\n if (missing !== action.skippedActions) {\n throw inconsistent('the wallet counts other skips than the messages it did not send');\n }\n return missing > 0 ? 'skipped' : matched;\n}\n\n/**\n * The `internal_transfer` our jetton wallet `hop` sent onwards for our wallet `from`: the\n * message of a positive amount, `null` when it moved nothing.\n */\nfunction onward(hop: V3Transaction, from: string): V3Message | null {\n let nothingMoved = false;\n for (const m of hop.outMsgs) {\n const body = messageBody(m);\n const internal = body ? decodeJettonInternalTransfer(body) : null;\n if (!internal || internal.from !== from) continue;\n // From the sender, a positive amount, never the exact one (fee-on-transfer tokens).\n if (internal.amount > 0n) return m;\n nothingMoved = true; // a zero amount: nothing moved, so `failed` is accurate\n }\n if (nothingMoved) return null;\n throw inconsistent('the jetton wallet ran the transfer but sent none from the sender');\n}\n\n/**\n * What one output did: failed (with why, and the deliveries the chain records it in), a\n * jetton leg to confirm, or delivered.\n */\ntype Outcome =\n | {\n readonly failed: string;\n readonly path: readonly Delivery[];\n readonly end: BounceEvidence['end'];\n }\n | { readonly leg: JettonLeg }\n | { readonly delivered: true };\n\n/** `tx`, which received `message`, as a delivery on a bounce's path. */\nconst delivery = (tx: V3Transaction, message: V3Message): Delivery => ({\n account: tx.account,\n lt: tx.lt,\n hash: tx.hash,\n message: message.hash,\n});\n\n/** The outcome of the output `sent` of our wallet `from`, checked against the chain. */\nfunction outcomeOf(trace: V3Trace, from: string, sent: Sent): Outcome {\n const { out, bounceable, jettonRecipient } = sent;\n const hop = receiver(trace, out, from);\n const first = delivery(hop, out);\n const hopRan = ran(hop);\n // A bounce phase exists only for a bounceable message, and always when its compute\n // phase failed (collator.cpp, transaction.cpp `bounce_enabled`). A bounce on a message\n // we signed non-bounceable would fail a delivery that credited the value; a failed\n // bounceable delivery without one lacks data. The flag we signed decides, even when the\n // indexer leaves the delivery's own flag out.\n if (\n (hop.inMsg?.bounce !== null && hop.inMsg?.bounce !== bounceable) ||\n (hop.bounce !== undefined && !bounceable) ||\n (bounceable && !hop.compute.success && hop.bounce === undefined)\n ) {\n throw inconsistent('the delivery contradicts the bounce flag we signed');\n }\n if (jettonRecipient === undefined) {\n // The value stays unless the bounce phase sent it back.\n return hop.bounce === 'ok'\n ? { failed: REASONS.bounced, path: [first], end: 'bounced' }\n : { delivered: true };\n }\n // The owner's jetton wallet ran `transfer` and sent `internal_transfer` onwards. A\n // failed phase dropped its state: the jettons never left.\n if (!hopRan) return { failed: REASONS.jettonBounced, path: [first], end: 'unran' };\n const arrivalMessage = onward(hop, from);\n if (!arrivalMessage) {\n return { failed: REASONS.jettonBounced, path: [first], end: 'unmoved' };\n }\n // TEP-74 707: the receiving wallet takes it only from the sender's jetton wallet.\n const arrival = receiver(trace, arrivalMessage, hop.account);\n // A failed phase drops the credit: the jettons came back, or never arrived.\n if (!ran(arrival)) {\n return {\n failed: REASONS.jettonBounced,\n path: [first, delivery(arrival, arrivalMessage)],\n end: 'unran',\n };\n }\n return {\n leg: {\n senderWallet: hop.account,\n recipientWallet: arrival.account,\n recipient: jettonRecipient,\n },\n };\n}\n\n/** The verdict on the Attempt whose wallet transaction is `root`, within `trace`. */\nexport function attemptVerdict(root: V3Transaction, trace: V3Trace | null): Verdict {\n if (!root.inMsg || root.inMsg.source !== null) {\n throw inconsistent('the attempt is not an external message');\n }\n if (!consumesSeqno(root)) return PENDING;\n if (!root.compute.success) return failed(REASONS.walletFailed);\n const sent = sentMessages(root);\n if (sent === 'threw') return failed(REASONS.walletFailed);\n if (sent === 'skipped') return failed(REASONS.skipped);\n if (!trace || !trace.complete) return PENDING;\n // Every output is checked before any decides, so an early failure never hides a later\n // contradiction.\n const outcomes = sent.map((each) => outcomeOf(trace, root.account, each));\n for (const outcome of outcomes) {\n if ('failed' in outcome) {\n const { account, lt, hash } = root;\n return failed(\n outcome.failed,\n Object.freeze({\n root: { account, lt, hash },\n path: outcome.path,\n end: outcome.end,\n }),\n );\n }\n }\n const legs = outcomes.flatMap((outcome) => ('leg' in outcome ? [outcome.leg] : []));\n return Object.freeze({ kind: 'success', legs });\n}\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK-free types of the TON family: the wallet identity, the `ext.ton` API, fee
|
|
3
|
+
* details and overrides, and the transport tags. Nothing here imports an SDK, so the
|
|
4
|
+
* composition root can export these types.
|
|
5
|
+
*/
|
|
6
|
+
import type { CallOptions } from '../../core/transport/types';
|
|
7
|
+
declare module '../../index' {
|
|
8
|
+
interface ChainRegistry {
|
|
9
|
+
ton: {
|
|
10
|
+
family: 'ton';
|
|
11
|
+
network: 'mainnet' | 'testnet';
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface FamilyRegistry {
|
|
15
|
+
ton: {
|
|
16
|
+
library: '@ton/ton';
|
|
17
|
+
ext: TonExt;
|
|
18
|
+
fee: TonFeeDetails;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export type TonWalletVersion = 'v4r2' | 'v5r1';
|
|
23
|
+
/**
|
|
24
|
+
* The wallet contract behind a TON address. Every field determines the address,
|
|
25
|
+
* so it is wallet config (`wallets.<name>.ton`), never a per-call option.
|
|
26
|
+
* - v4r2: `subwalletId` defaults to `698983191 + workchain`.
|
|
27
|
+
* - v5r1: `subwalletNumber` defaults to 0 (15 bits); `networkGlobalId` defaults to the
|
|
28
|
+
* network's global id (-239 mainnet, -3 testnet) and must equal it.
|
|
29
|
+
*/
|
|
30
|
+
export type TonWalletIdentity = {
|
|
31
|
+
readonly version: 'v4r2';
|
|
32
|
+
readonly workchain?: 0 | -1;
|
|
33
|
+
readonly subwalletId?: number;
|
|
34
|
+
} | {
|
|
35
|
+
readonly version: 'v5r1';
|
|
36
|
+
readonly workchain?: 0 | -1;
|
|
37
|
+
readonly subwalletNumber?: number;
|
|
38
|
+
readonly networkGlobalId?: number;
|
|
39
|
+
};
|
|
40
|
+
/** `bc.ext.ton`: the TON family extension. */
|
|
41
|
+
export interface TonExt {
|
|
42
|
+
readonly ton: {
|
|
43
|
+
/** The wallet's seqno at the latest masterchain block; 0 while it is not deployed. */
|
|
44
|
+
getSeqno(address: string): Promise<bigint>;
|
|
45
|
+
/** The jetton wallet that `owner` holds for the jetton `master` (raw form). */
|
|
46
|
+
jettonWallet(owner: string, master: string): Promise<string>;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `FeeEstimate.details` of the `ton` fee kind, in nanograms. The `network` charge is
|
|
51
|
+
* `importFee + gasFee + storageFee + forwardFee`; a jetton transfer adds an `attached`
|
|
52
|
+
* charge (`attached` per output), whose unspent part the jetton wallet refunds.
|
|
53
|
+
*/
|
|
54
|
+
export interface TonFeeDetails {
|
|
55
|
+
/** The inbound external message's import fee. */
|
|
56
|
+
readonly importFee: bigint;
|
|
57
|
+
/** The wallet's compute phase, from the endpoint's emulation. */
|
|
58
|
+
readonly gasFee: bigint;
|
|
59
|
+
readonly storageFee: bigint;
|
|
60
|
+
/** The forward fees of every outgoing internal message (full `fwd_fee`), counted once. */
|
|
61
|
+
readonly forwardFee: bigint;
|
|
62
|
+
/**
|
|
63
|
+
* Where `forwardFee` comes from: the endpoint's emulation (`fwd_fee`, which follows
|
|
64
|
+
* the real action list), or, when it reports none, config params 24/25.
|
|
65
|
+
*/
|
|
66
|
+
readonly forwardFeeSource: 'emulated' | 'computed';
|
|
67
|
+
/** Jetton transfers: the value attached to each jetton wallet message. */
|
|
68
|
+
readonly attached?: bigint;
|
|
69
|
+
/** Jetton transfers: `forward_ton_amount`, which pays for the recipient's notification. */
|
|
70
|
+
readonly forwardAmount?: bigint;
|
|
71
|
+
/** Whether the message deploys the wallet (its first send carries the `StateInit`). */
|
|
72
|
+
readonly deploy: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* An explicit TON fee (`TransferIntent.fee`). TON fees are fixed by the network config, so
|
|
76
|
+
* there is nothing to bid; a jetton transfer may change the value attached to each jetton
|
|
77
|
+
* wallet message (default: the network's `jettonAttached`).
|
|
78
|
+
*/
|
|
79
|
+
export interface TonFeeOverride {
|
|
80
|
+
readonly attached?: bigint;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The seqno ordering a TON build records: the signed seqno and `valid_until`, and
|
|
84
|
+
* `validFrom`, the chain time the build ran at (the state's `sync_utime`, and never later
|
|
85
|
+
* than the local clock), in seconds. The message cannot run in a block older than that, less
|
|
86
|
+
* the builder's chain-time tolerance, so a proof that it was not included walks the
|
|
87
|
+
* wallet's history back to there, whatever the network's `validForSeconds` is now. It is a
|
|
88
|
+
* core `seqno` ordering with one more property, which the core stores whole. A store that
|
|
89
|
+
* drops `validFrom` costs only liveness (the proof and the replay guard fall back to a
|
|
90
|
+
* one-day window); one that moves it later could hide a wallet reset and prove "not
|
|
91
|
+
* included" falsely, and a `rebuild` would then pay twice.
|
|
92
|
+
*/
|
|
93
|
+
export interface TonSeqnoOrdering {
|
|
94
|
+
readonly kind: 'seqno';
|
|
95
|
+
readonly seqno: bigint;
|
|
96
|
+
readonly validUntil: number;
|
|
97
|
+
readonly validFrom: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The transport tags every TON I/O call carries, as the `ChainDriver` contract table sets
|
|
101
|
+
* them. A caller's `quorumKey` replaces the call's default consensus key: proofs attest a
|
|
102
|
+
* monotone predicate, such as "my seqno is above n", instead of comparing data read at a
|
|
103
|
+
* moving head.
|
|
104
|
+
*/
|
|
105
|
+
export type TonCallTags = Pick<CallOptions, 'purpose' | 'retry' | 'quorum' | 'quorumKey' | 'fanout' | 'signal'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/ton/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * SDK-free types of the TON family: the wallet identity, the `ext.ton` API, fee\n * details and overrides, and the transport tags. Nothing here imports an SDK, so the\n * composition root can export these types.\n */\nimport type { CallOptions } from '../../core/transport/types';\n\n// Augment the registries through the package entry, as users do with 'crypto-aio'.\ndeclare module '../../index' {\n interface ChainRegistry {\n ton: { family: 'ton'; network: 'mainnet' | 'testnet' };\n }\n interface FamilyRegistry {\n ton: { library: '@ton/ton'; ext: TonExt; fee: TonFeeDetails };\n }\n}\n\nexport type TonWalletVersion = 'v4r2' | 'v5r1';\n\n/**\n * The wallet contract behind a TON address. Every field determines the address,\n * so it is wallet config (`wallets.<name>.ton`), never a per-call option.\n * - v4r2: `subwalletId` defaults to `698983191 + workchain`.\n * - v5r1: `subwalletNumber` defaults to 0 (15 bits); `networkGlobalId` defaults to the\n * network's global id (-239 mainnet, -3 testnet) and must equal it.\n */\nexport type TonWalletIdentity =\n | {\n readonly version: 'v4r2';\n readonly workchain?: 0 | -1;\n readonly subwalletId?: number;\n }\n | {\n readonly version: 'v5r1';\n readonly workchain?: 0 | -1;\n readonly subwalletNumber?: number;\n readonly networkGlobalId?: number;\n };\n\n/** `bc.ext.ton`: the TON family extension. */\nexport interface TonExt {\n readonly ton: {\n /** The wallet's seqno at the latest masterchain block; 0 while it is not deployed. */\n getSeqno(address: string): Promise<bigint>;\n /** The jetton wallet that `owner` holds for the jetton `master` (raw form). */\n jettonWallet(owner: string, master: string): Promise<string>;\n };\n}\n\n/**\n * `FeeEstimate.details` of the `ton` fee kind, in nanograms. The `network` charge is\n * `importFee + gasFee + storageFee + forwardFee`; a jetton transfer adds an `attached`\n * charge (`attached` per output), whose unspent part the jetton wallet refunds.\n */\nexport interface TonFeeDetails {\n /** The inbound external message's import fee. */\n readonly importFee: bigint;\n /** The wallet's compute phase, from the endpoint's emulation. */\n readonly gasFee: bigint;\n readonly storageFee: bigint;\n /** The forward fees of every outgoing internal message (full `fwd_fee`), counted once. */\n readonly forwardFee: bigint;\n /**\n * Where `forwardFee` comes from: the endpoint's emulation (`fwd_fee`, which follows\n * the real action list), or, when it reports none, config params 24/25.\n */\n readonly forwardFeeSource: 'emulated' | 'computed';\n /** Jetton transfers: the value attached to each jetton wallet message. */\n readonly attached?: bigint;\n /** Jetton transfers: `forward_ton_amount`, which pays for the recipient's notification. */\n readonly forwardAmount?: bigint;\n /** Whether the message deploys the wallet (its first send carries the `StateInit`). */\n readonly deploy: boolean;\n}\n\n/**\n * An explicit TON fee (`TransferIntent.fee`). TON fees are fixed by the network config, so\n * there is nothing to bid; a jetton transfer may change the value attached to each jetton\n * wallet message (default: the network's `jettonAttached`).\n */\nexport interface TonFeeOverride {\n readonly attached?: bigint;\n}\n\n/**\n * The seqno ordering a TON build records: the signed seqno and `valid_until`, and\n * `validFrom`, the chain time the build ran at (the state's `sync_utime`, and never later\n * than the local clock), in seconds. The message cannot run in a block older than that, less\n * the builder's chain-time tolerance, so a proof that it was not included walks the\n * wallet's history back to there, whatever the network's `validForSeconds` is now. It is a\n * core `seqno` ordering with one more property, which the core stores whole. A store that\n * drops `validFrom` costs only liveness (the proof and the replay guard fall back to a\n * one-day window); one that moves it later could hide a wallet reset and prove \"not\n * included\" falsely, and a `rebuild` would then pay twice.\n */\nexport interface TonSeqnoOrdering {\n readonly kind: 'seqno';\n readonly seqno: bigint;\n readonly validUntil: number;\n readonly validFrom: number;\n}\n\n/**\n * The transport tags every TON I/O call carries, as the `ChainDriver` contract table sets\n * them. A caller's `quorumKey` replaces the call's default consensus key: proofs attest a\n * monotone predicate, such as \"my seqno is above n\", instead of comparing data read at a\n * moving head.\n */\nexport type TonCallTags = Pick<\n CallOptions,\n 'purpose' | 'retry' | 'quorum' | 'quorumKey' | 'fanout' | 'signal'\n>;\n"]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TON wallet contracts, over `@ton/core` and `@ton/ton`: the wallet identity,
|
|
3
|
+
* its address and `StateInit`, the signing message, and the external message around it.
|
|
4
|
+
* Loaded only through the adapter manifest's `load()`.
|
|
5
|
+
*
|
|
6
|
+
* Signing flow: `build` asks the SDK for the transfer body with a zero signature and keeps
|
|
7
|
+
* the whole unsigned external message (a BOC) as the payload; the one ed25519 request signs
|
|
8
|
+
* the signing message's cell hash. `assemble` finds the 512 zero bits the signature
|
|
9
|
+
* replaces (front for v4r2, tail for v5r1) by the one position whose remainder hashes to
|
|
10
|
+
* the signed digest, so it needs no wallet version and cannot write a signature anywhere
|
|
11
|
+
* else.
|
|
12
|
+
*/
|
|
13
|
+
import { Cell, type MessageRelaxed, type StateInit } from '@ton/core';
|
|
14
|
+
import type { WalletOptions } from '../../core/driver/types';
|
|
15
|
+
import { type TonWorkchain } from './address';
|
|
16
|
+
import { sdkAddress } from './messages';
|
|
17
|
+
import type { TonWalletVersion } from './types';
|
|
18
|
+
/** Messages one external request may carry: 4 refs per cell (v4r2), 255 (v5r1). */
|
|
19
|
+
export declare const MAX_MESSAGES: Readonly<Record<TonWalletVersion, number>>;
|
|
20
|
+
/** Pay forward fees separately and never fail the action phase (W5 requires +2). */
|
|
21
|
+
export declare const SEND_MODE: number;
|
|
22
|
+
/** The resolved wallet identity: every field that determines the address. */
|
|
23
|
+
export type TonIdentity = {
|
|
24
|
+
readonly version: 'v4r2';
|
|
25
|
+
readonly workchain: TonWorkchain;
|
|
26
|
+
readonly subwalletId: number;
|
|
27
|
+
} | {
|
|
28
|
+
readonly version: 'v5r1';
|
|
29
|
+
readonly workchain: TonWorkchain;
|
|
30
|
+
readonly subwalletNumber: number;
|
|
31
|
+
readonly networkGlobalId: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* `wallets.<name>.ton` validated against the network: a v5r1 wallet id made for
|
|
35
|
+
* another network is refused before any key is used. Every problem is `CONFIG_INVALID`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveIdentity(wallet: WalletOptions | undefined, globalId: number): TonIdentity;
|
|
38
|
+
/** The wallet's raw address: the hash of its `StateInit` in its workchain. */
|
|
39
|
+
export declare function walletAddress(identity: TonIdentity, publicKey: Uint8Array): string;
|
|
40
|
+
/** The code and data a first message carries to deploy the wallet. */
|
|
41
|
+
export declare function walletStateInit(identity: TonIdentity, publicKey: Uint8Array): StateInit;
|
|
42
|
+
/** The wallet's wire wallet id (v4r2: the subwallet id; v5r1: the signed 32-bit id). */
|
|
43
|
+
export declare function walletIdOf(identity: TonIdentity, publicKey: Uint8Array): number;
|
|
44
|
+
export interface UnsignedRequest {
|
|
45
|
+
/** The unsigned external message: the wallet body with 512 zero bits for the signature. */
|
|
46
|
+
readonly message: Cell;
|
|
47
|
+
/** The signing message's cell hash: what the ed25519 key signs. */
|
|
48
|
+
readonly digest: Uint8Array;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The external request for `messages` at `seqno`, valid while chain time is before
|
|
52
|
+
* `validUntil` (seconds). `init` deploys the wallet with its first message.
|
|
53
|
+
*/
|
|
54
|
+
export declare function unsignedRequest(identity: TonIdentity, publicKey: Uint8Array, args: {
|
|
55
|
+
readonly seqno: number;
|
|
56
|
+
readonly validUntil: number;
|
|
57
|
+
readonly messages: readonly MessageRelaxed[];
|
|
58
|
+
readonly deploy: boolean;
|
|
59
|
+
}): Promise<UnsignedRequest>;
|
|
60
|
+
/**
|
|
61
|
+
* The signed external message: `signature` in place of the 512 zero bits whose remainder
|
|
62
|
+
* hashes to `digest` (the front for v4r2, the tail for v5r1). Refuses (`SIGNING_FAILED`) a
|
|
63
|
+
* payload with no such position, so a signature can never land anywhere else.
|
|
64
|
+
*/
|
|
65
|
+
export declare function signedRequest(unsigned: Cell, digest: Uint8Array, signature: Uint8Array): Cell;
|
|
66
|
+
/**
|
|
67
|
+
* TEP-467: the hash of the external-in message with `src` = addr_none, `import_fee` = 0,
|
|
68
|
+
* no `init`, and the body always as a reference. Stable across relays; the Attempt id.
|
|
69
|
+
*/
|
|
70
|
+
export declare function normalizedHash(externalMessage: Cell): Uint8Array;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the wallet request `body` (external, or a W5
|
|
73
|
+
* `internal_signed` request relayed in an internal message) is `from`'s own. Anyone can post
|
|
74
|
+
* a relayed body, and a lone lying indexer can make up an external one, so a request
|
|
75
|
+
* proves nothing unless its ed25519 signature verifies over the rest of the request under
|
|
76
|
+
* `publicKey`, the wallet's key (v4r2: the first 512 bits; v5r1: the last 512), and its
|
|
77
|
+
* wallet id derives `from` with that key (v4r2: the subwallet id in `from`'s workchain;
|
|
78
|
+
* v5r1: the signed wallet id). A request of another wallet sharing the key, replayed
|
|
79
|
+
* here, never counts. For a relayed request the caller also requires the transaction's
|
|
80
|
+
* compute phase to have succeeded, i.e. the wallet ran it.
|
|
81
|
+
*/
|
|
82
|
+
export declare function requestIsOwn(from: string, body: Cell, publicKey: Uint8Array, globalId: number): boolean;
|
|
83
|
+
/** The SDK's `Address` for a raw address, parsed strictly. */
|
|
84
|
+
export { sdkAddress };
|
|
85
|
+
/** The TEP-467 hash (hex) of the external message `body` to `account` would travel in. */
|
|
86
|
+
export declare function externalHashOf(account: string, body: Cell): string;
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sdkAddress = exports.SEND_MODE = exports.MAX_MESSAGES = void 0;
|
|
4
|
+
exports.resolveIdentity = resolveIdentity;
|
|
5
|
+
exports.walletAddress = walletAddress;
|
|
6
|
+
exports.walletStateInit = walletStateInit;
|
|
7
|
+
exports.walletIdOf = walletIdOf;
|
|
8
|
+
exports.unsignedRequest = unsignedRequest;
|
|
9
|
+
exports.signedRequest = signedRequest;
|
|
10
|
+
exports.normalizedHash = normalizedHash;
|
|
11
|
+
exports.requestIsOwn = requestIsOwn;
|
|
12
|
+
exports.externalHashOf = externalHashOf;
|
|
13
|
+
/**
|
|
14
|
+
* TON wallet contracts, over `@ton/core` and `@ton/ton`: the wallet identity,
|
|
15
|
+
* its address and `StateInit`, the signing message, and the external message around it.
|
|
16
|
+
* Loaded only through the adapter manifest's `load()`.
|
|
17
|
+
*
|
|
18
|
+
* Signing flow: `build` asks the SDK for the transfer body with a zero signature and keeps
|
|
19
|
+
* the whole unsigned external message (a BOC) as the payload; the one ed25519 request signs
|
|
20
|
+
* the signing message's cell hash. `assemble` finds the 512 zero bits the signature
|
|
21
|
+
* replaces (front for v4r2, tail for v5r1) by the one position whose remainder hashes to
|
|
22
|
+
* the signed digest, so it needs no wallet version and cannot write a signature anywhere
|
|
23
|
+
* else.
|
|
24
|
+
*/
|
|
25
|
+
const core_1 = require("@ton/core");
|
|
26
|
+
const ed25519_1 = require("@noble/curves/ed25519");
|
|
27
|
+
const ton_1 = require("@ton/ton");
|
|
28
|
+
const error_1 = require("../../core/errors/error");
|
|
29
|
+
const address_1 = require("./address");
|
|
30
|
+
const messages_1 = require("./messages");
|
|
31
|
+
Object.defineProperty(exports, "sdkAddress", { enumerable: true, get: function () { return messages_1.sdkAddress; } });
|
|
32
|
+
/** Messages one external request may carry: 4 refs per cell (v4r2), 255 (v5r1). */
|
|
33
|
+
exports.MAX_MESSAGES = Object.freeze({
|
|
34
|
+
v4r2: 4,
|
|
35
|
+
v5r1: 255,
|
|
36
|
+
});
|
|
37
|
+
/** Pay forward fees separately and never fail the action phase (W5 requires +2). */
|
|
38
|
+
exports.SEND_MODE = core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS;
|
|
39
|
+
const V4_KEYS = new Set(['version', 'workchain', 'subwalletId']);
|
|
40
|
+
const V5_KEYS = new Set(['version', 'workchain', 'subwalletNumber', 'networkGlobalId']);
|
|
41
|
+
/**
|
|
42
|
+
* `wallets.<name>.ton` validated against the network: a v5r1 wallet id made for
|
|
43
|
+
* another network is refused before any key is used. Every problem is `CONFIG_INVALID`.
|
|
44
|
+
*/
|
|
45
|
+
function resolveIdentity(wallet, globalId) {
|
|
46
|
+
const fail = (reason) => {
|
|
47
|
+
throw new error_1.ConfigError('CONFIG_INVALID', `TON wallet: ${reason}`);
|
|
48
|
+
};
|
|
49
|
+
const ton = wallet?.ton;
|
|
50
|
+
if (ton === undefined || ton === null || typeof ton !== 'object') {
|
|
51
|
+
return fail(`set wallets.<name>.ton = { version: 'v4r2' | 'v5r1' }`);
|
|
52
|
+
}
|
|
53
|
+
const config = ton;
|
|
54
|
+
const version = config.version;
|
|
55
|
+
if (version !== 'v4r2' && version !== 'v5r1') {
|
|
56
|
+
return fail(`version must be 'v4r2' or 'v5r1'`);
|
|
57
|
+
}
|
|
58
|
+
const allowed = version === 'v4r2' ? V4_KEYS : V5_KEYS;
|
|
59
|
+
for (const key of Object.keys(config)) {
|
|
60
|
+
if (config[key] !== undefined && !allowed.has(key)) {
|
|
61
|
+
// The caller's key is never echoed (it could be a pasted secret).
|
|
62
|
+
fail(`a ${version} wallet takes only ${[...allowed].join(', ')}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const workchain = config.workchain ?? 0;
|
|
66
|
+
if (workchain !== 0 && workchain !== -1)
|
|
67
|
+
fail('workchain must be 0 or -1');
|
|
68
|
+
const wc = workchain;
|
|
69
|
+
if (version === 'v4r2') {
|
|
70
|
+
const subwalletId = config.subwalletId ?? 698983191 + wc;
|
|
71
|
+
if (!Number.isInteger(subwalletId) ||
|
|
72
|
+
subwalletId < 0 ||
|
|
73
|
+
subwalletId > 0xffffffff) {
|
|
74
|
+
fail('subwalletId must be an integer in [0, 2^32 - 1]');
|
|
75
|
+
}
|
|
76
|
+
return { version, workchain: wc, subwalletId: subwalletId };
|
|
77
|
+
}
|
|
78
|
+
const subwalletNumber = config.subwalletNumber ?? 0;
|
|
79
|
+
if (!Number.isInteger(subwalletNumber) ||
|
|
80
|
+
subwalletNumber < 0 ||
|
|
81
|
+
subwalletNumber > 0x7fff) {
|
|
82
|
+
fail('subwalletNumber must be an integer in [0, 32767]');
|
|
83
|
+
}
|
|
84
|
+
const networkGlobalId = config.networkGlobalId ?? globalId;
|
|
85
|
+
if (networkGlobalId !== globalId) {
|
|
86
|
+
fail(`networkGlobalId is not this network's (${globalId})`);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
version,
|
|
90
|
+
workchain: wc,
|
|
91
|
+
subwalletNumber: subwalletNumber,
|
|
92
|
+
networkGlobalId: globalId,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** A strict (RFC 8032) encoding of a point that is not of small order. */
|
|
96
|
+
function canonicalKey(publicKey) {
|
|
97
|
+
try {
|
|
98
|
+
return !ed25519_1.ed25519.Point.fromHex(publicKey, false).isSmallOrder();
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const isInt = (value, min, max) => Number.isInteger(value) && value >= min && value <= max;
|
|
105
|
+
/**
|
|
106
|
+
* Every identity field fits the wire field the SDK writes it into (workchain
|
|
107
|
+
* int8, subwallet id uint32, subwallet number uint15, network id int32), so an identity
|
|
108
|
+
* not made by `resolveIdentity` is refused rather than wrapped or thrown as a bare `Error`.
|
|
109
|
+
*/
|
|
110
|
+
function identityFits(identity) {
|
|
111
|
+
if (identity.workchain !== 0 && identity.workchain !== -1)
|
|
112
|
+
return false;
|
|
113
|
+
if (identity.version === 'v4r2')
|
|
114
|
+
return isInt(identity.subwalletId, 0, 0xffffffff);
|
|
115
|
+
return (identity.version === 'v5r1' &&
|
|
116
|
+
isInt(identity.subwalletNumber, 0, 0x7fff) &&
|
|
117
|
+
isInt(identity.networkGlobalId, -0x80000000, 0x7fffffff));
|
|
118
|
+
}
|
|
119
|
+
function contractOf(identity, publicKey) {
|
|
120
|
+
if (!identityFits(identity)) {
|
|
121
|
+
throw new error_1.ConfigError('CONFIG_INVALID', 'the TON wallet identity is out of range');
|
|
122
|
+
}
|
|
123
|
+
if (publicKey.length !== 32 || !canonicalKey(publicKey)) {
|
|
124
|
+
throw new error_1.ConfigError('CONFIG_INVALID', 'a TON wallet key must be a canonical 32-byte ed25519 public key');
|
|
125
|
+
}
|
|
126
|
+
const key = Buffer.from(publicKey);
|
|
127
|
+
if (identity.version === 'v4r2') {
|
|
128
|
+
return ton_1.WalletContractV4.create({
|
|
129
|
+
workchain: identity.workchain,
|
|
130
|
+
publicKey: key,
|
|
131
|
+
walletId: identity.subwalletId,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// Every field explicit: the SDK's defaults are mainnet's id and workchain 0.
|
|
135
|
+
return ton_1.WalletContractV5R1.create({
|
|
136
|
+
publicKey: key,
|
|
137
|
+
walletId: {
|
|
138
|
+
networkGlobalId: identity.networkGlobalId,
|
|
139
|
+
context: {
|
|
140
|
+
workchain: identity.workchain,
|
|
141
|
+
walletVersion: 'v5r1',
|
|
142
|
+
subwalletNumber: identity.subwalletNumber,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/** The wallet's raw address: the hash of its `StateInit` in its workchain. */
|
|
148
|
+
function walletAddress(identity, publicKey) {
|
|
149
|
+
const contract = contractOf(identity, publicKey);
|
|
150
|
+
return (0, address_1.rawAddress)(identity.workchain, contract.address.hash);
|
|
151
|
+
}
|
|
152
|
+
/** The code and data a first message carries to deploy the wallet. */
|
|
153
|
+
function walletStateInit(identity, publicKey) {
|
|
154
|
+
const { init } = contractOf(identity, publicKey);
|
|
155
|
+
return { code: init.code, data: init.data };
|
|
156
|
+
}
|
|
157
|
+
/** The wallet's wire wallet id (v4r2: the subwallet id; v5r1: the signed 32-bit id). */
|
|
158
|
+
function walletIdOf(identity, publicKey) {
|
|
159
|
+
const contract = contractOf(identity, publicKey);
|
|
160
|
+
if (contract instanceof ton_1.WalletContractV4)
|
|
161
|
+
return contract.walletId;
|
|
162
|
+
// v5r1 data: is_signature_allowed:1 seqno:32 wallet_id:int32 public_key:256 extensions.
|
|
163
|
+
const data = contract.init.data.beginParse();
|
|
164
|
+
data.skip(1 + 32);
|
|
165
|
+
return data.loadInt(32);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The external request for `messages` at `seqno`, valid while chain time is before
|
|
169
|
+
* `validUntil` (seconds). `init` deploys the wallet with its first message.
|
|
170
|
+
*/
|
|
171
|
+
async function unsignedRequest(identity, publicKey, args) {
|
|
172
|
+
// The seqno is a uint32 on the wire, never wrapped.
|
|
173
|
+
if (!Number.isSafeInteger(args.seqno) || args.seqno < 0 || args.seqno > 0xffffffff) {
|
|
174
|
+
throw new error_1.ValidationError('INVALID_INTENT', 'seqno must be a uint32');
|
|
175
|
+
}
|
|
176
|
+
// The SDK falls back to the wall clock for a falsy timeout; never let it.
|
|
177
|
+
if (!Number.isSafeInteger(args.validUntil) ||
|
|
178
|
+
args.validUntil <= 0 ||
|
|
179
|
+
args.validUntil > 0xffffffff) {
|
|
180
|
+
throw new error_1.ValidationError('INVALID_INTENT', 'validUntil must be a uint32 above 0');
|
|
181
|
+
}
|
|
182
|
+
if (args.messages.length === 0 ||
|
|
183
|
+
args.messages.length > exports.MAX_MESSAGES[identity.version]) {
|
|
184
|
+
throw new error_1.ValidationError('INVALID_INTENT', `a ${identity.version} request carries 1 to ${exports.MAX_MESSAGES[identity.version]} messages`);
|
|
185
|
+
}
|
|
186
|
+
const contract = contractOf(identity, publicKey);
|
|
187
|
+
let signing;
|
|
188
|
+
const transfer = {
|
|
189
|
+
seqno: args.seqno,
|
|
190
|
+
timeout: args.validUntil,
|
|
191
|
+
sendMode: exports.SEND_MODE,
|
|
192
|
+
messages: [...args.messages],
|
|
193
|
+
signer: async (cell) => {
|
|
194
|
+
signing = cell;
|
|
195
|
+
return Buffer.alloc(64);
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
let message;
|
|
199
|
+
try {
|
|
200
|
+
const body = await (contract instanceof ton_1.WalletContractV4
|
|
201
|
+
? contract.createTransfer(transfer)
|
|
202
|
+
: contract.createTransfer(transfer));
|
|
203
|
+
message = (0, core_1.beginCell)()
|
|
204
|
+
.store((0, core_1.storeMessage)((0, core_1.external)({
|
|
205
|
+
to: contract.address,
|
|
206
|
+
body,
|
|
207
|
+
...(args.deploy
|
|
208
|
+
? { init: { code: contract.init.code, data: contract.init.data } }
|
|
209
|
+
: {}),
|
|
210
|
+
})))
|
|
211
|
+
.endCell();
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
// The SDK throws bare errors that may name a value; `nativeMessage` and
|
|
215
|
+
// `jettonMessage` range-check theirs, so only a hand-built message ends here.
|
|
216
|
+
throw new error_1.ValidationError('INVALID_INTENT', 'the TON request cannot be encoded');
|
|
217
|
+
}
|
|
218
|
+
if (!signing) {
|
|
219
|
+
throw new error_1.SigningError('SIGNING_FAILED', 'the SDK did not produce a signing message');
|
|
220
|
+
}
|
|
221
|
+
return { message, digest: new Uint8Array(signing.hash()) };
|
|
222
|
+
}
|
|
223
|
+
/** The message in `cell`, or undefined when it holds none (the SDK throws a bare `Error`). */
|
|
224
|
+
function messageOf(cell) {
|
|
225
|
+
try {
|
|
226
|
+
return (0, core_1.loadMessage)(cell.beginParse());
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** A cell of `bits` then `refs`. */
|
|
233
|
+
function cellOf(parts, refs) {
|
|
234
|
+
const builder = (0, core_1.beginCell)();
|
|
235
|
+
for (const part of parts) {
|
|
236
|
+
if (Buffer.isBuffer(part))
|
|
237
|
+
builder.storeBuffer(part);
|
|
238
|
+
else
|
|
239
|
+
builder.storeBits(part);
|
|
240
|
+
}
|
|
241
|
+
for (const ref of refs)
|
|
242
|
+
builder.storeRef(ref);
|
|
243
|
+
return builder.endCell();
|
|
244
|
+
}
|
|
245
|
+
const ZERO_SIGNATURE = Buffer.alloc(64);
|
|
246
|
+
/**
|
|
247
|
+
* The signed external message: `signature` in place of the 512 zero bits whose remainder
|
|
248
|
+
* hashes to `digest` (the front for v4r2, the tail for v5r1). Refuses (`SIGNING_FAILED`) a
|
|
249
|
+
* payload with no such position, so a signature can never land anywhere else.
|
|
250
|
+
*/
|
|
251
|
+
function signedRequest(unsigned, digest, signature) {
|
|
252
|
+
if (signature.length !== 64) {
|
|
253
|
+
throw new error_1.SigningError('SIGNING_FAILED', 'a TON signature is 64 bytes');
|
|
254
|
+
}
|
|
255
|
+
const message = messageOf(unsigned);
|
|
256
|
+
if (message?.info.type !== 'external-in') {
|
|
257
|
+
throw new error_1.SigningError('SIGNING_FAILED', 'the unsigned TON payload is not an external message');
|
|
258
|
+
}
|
|
259
|
+
const { body } = message;
|
|
260
|
+
const length = body.bits.length;
|
|
261
|
+
const expected = Buffer.from(digest);
|
|
262
|
+
const zero = cellOf([ZERO_SIGNATURE], []).bits;
|
|
263
|
+
const sig = Buffer.from(signature);
|
|
264
|
+
let signedBody;
|
|
265
|
+
if (length >= 512) {
|
|
266
|
+
const front = body.bits.substring(0, 512);
|
|
267
|
+
const afterFront = body.bits.substring(512, length - 512);
|
|
268
|
+
const tail = body.bits.substring(length - 512, 512);
|
|
269
|
+
const beforeTail = body.bits.substring(0, length - 512);
|
|
270
|
+
if (front.equals(zero) && cellOf([afterFront], body.refs).hash().equals(expected)) {
|
|
271
|
+
signedBody = cellOf([sig, afterFront], body.refs);
|
|
272
|
+
}
|
|
273
|
+
else if (tail.equals(zero) &&
|
|
274
|
+
cellOf([beforeTail], body.refs).hash().equals(expected)) {
|
|
275
|
+
signedBody = cellOf([beforeTail, sig], body.refs);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (!signedBody) {
|
|
279
|
+
throw new error_1.SigningError('SIGNING_FAILED', 'the unsigned TON payload does not match its signing request');
|
|
280
|
+
}
|
|
281
|
+
return (0, core_1.beginCell)()
|
|
282
|
+
.store((0, core_1.storeMessage)({
|
|
283
|
+
info: message.info,
|
|
284
|
+
...(message.init ? { init: message.init } : {}),
|
|
285
|
+
body: signedBody,
|
|
286
|
+
}))
|
|
287
|
+
.endCell();
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* TEP-467: the hash of the external-in message with `src` = addr_none, `import_fee` = 0,
|
|
291
|
+
* no `init`, and the body always as a reference. Stable across relays; the Attempt id.
|
|
292
|
+
*/
|
|
293
|
+
function normalizedHash(externalMessage) {
|
|
294
|
+
const message = messageOf(externalMessage);
|
|
295
|
+
if (message?.info.type !== 'external-in') {
|
|
296
|
+
throw new error_1.ValidationError('INVALID_INTENT', 'not an external-in message');
|
|
297
|
+
}
|
|
298
|
+
const normalized = (0, core_1.beginCell)()
|
|
299
|
+
.storeUint(2, 2)
|
|
300
|
+
.storeUint(0, 2)
|
|
301
|
+
.storeAddress(message.info.dest)
|
|
302
|
+
.storeCoins(0)
|
|
303
|
+
.storeBit(false)
|
|
304
|
+
.storeBit(true)
|
|
305
|
+
.storeRef(message.body)
|
|
306
|
+
.endCell();
|
|
307
|
+
return new Uint8Array(normalized.hash());
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Whether the wallet request `body` (external, or a W5
|
|
311
|
+
* `internal_signed` request relayed in an internal message) is `from`'s own. Anyone can post
|
|
312
|
+
* a relayed body, and a lone lying indexer can make up an external one, so a request
|
|
313
|
+
* proves nothing unless its ed25519 signature verifies over the rest of the request under
|
|
314
|
+
* `publicKey`, the wallet's key (v4r2: the first 512 bits; v5r1: the last 512), and its
|
|
315
|
+
* wallet id derives `from` with that key (v4r2: the subwallet id in `from`'s workchain;
|
|
316
|
+
* v5r1: the signed wallet id). A request of another wallet sharing the key, replayed
|
|
317
|
+
* here, never counts. For a relayed request the caller also requires the transaction's
|
|
318
|
+
* compute phase to have succeeded, i.e. the wallet ran it.
|
|
319
|
+
*/
|
|
320
|
+
function requestIsOwn(from, body, publicKey, globalId) {
|
|
321
|
+
try {
|
|
322
|
+
const length = body.bits.length;
|
|
323
|
+
if (length < 512 + 32 || publicKey.length !== 32)
|
|
324
|
+
return false;
|
|
325
|
+
const op = body.beginParse().preloadUint(32);
|
|
326
|
+
const v5 = op === messages_1.OP.w5SignedExternal || op === messages_1.OP.w5SignedInternal;
|
|
327
|
+
const [signed, rest] = v5
|
|
328
|
+
? [body.bits.substring(length - 512, 512), body.bits.substring(0, length - 512)]
|
|
329
|
+
: [body.bits.substring(0, 512), body.bits.substring(512, length - 512)];
|
|
330
|
+
const signing = cellOf([rest], body.refs);
|
|
331
|
+
const signature = cellOf([signed], []).beginParse().loadBuffer(64);
|
|
332
|
+
if (!ed25519_1.ed25519.verify(signature, signing.hash(), publicKey))
|
|
333
|
+
return false;
|
|
334
|
+
const identity = v5
|
|
335
|
+
? v5IdentityOf(signing.beginParse().skip(32).loadInt(32), globalId)
|
|
336
|
+
: v4IdentityOf(from, signing.beginParse().loadUint(32));
|
|
337
|
+
return identity !== undefined && walletAddress(identity, publicKey) === from;
|
|
338
|
+
}
|
|
339
|
+
catch {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/** The v4r2 identity a request's subwallet id names in `from`'s workchain. */
|
|
344
|
+
function v4IdentityOf(from, subwalletId) {
|
|
345
|
+
const workchain = Number(from.split(':')[0]);
|
|
346
|
+
if (workchain !== 0 && workchain !== -1)
|
|
347
|
+
return undefined;
|
|
348
|
+
return { version: 'v4r2', workchain, subwalletId };
|
|
349
|
+
}
|
|
350
|
+
/** The v5r1 identity a signed wallet id names: 1 bit set, workchain int8, version 0, uint15. */
|
|
351
|
+
function v5IdentityOf(walletId, globalId) {
|
|
352
|
+
const context = (walletId ^ globalId) | 0;
|
|
353
|
+
if (context >>> 31 !== 1 || ((context >> 15) & 0xff) !== 0)
|
|
354
|
+
return undefined;
|
|
355
|
+
const byte = (context >> 23) & 0xff;
|
|
356
|
+
const workchain = byte >= 128 ? byte - 256 : byte;
|
|
357
|
+
if (workchain !== 0 && workchain !== -1)
|
|
358
|
+
return undefined;
|
|
359
|
+
return {
|
|
360
|
+
version: 'v5r1',
|
|
361
|
+
workchain,
|
|
362
|
+
subwalletNumber: context & 0x7fff,
|
|
363
|
+
networkGlobalId: globalId,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/** The TEP-467 hash (hex) of the external message `body` to `account` would travel in. */
|
|
367
|
+
function externalHashOf(account, body) {
|
|
368
|
+
const message = (0, core_1.beginCell)()
|
|
369
|
+
.store((0, core_1.storeMessage)((0, core_1.external)({ to: (0, messages_1.sdkAddress)(account), body })))
|
|
370
|
+
.endCell();
|
|
371
|
+
return Buffer.from(normalizedHash(message)).toString('hex');
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=wallets.js.map
|