FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

6
node_modules/ox/Abi/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Abi.d.ts",
"main": "../_cjs/core/Abi.js",
"module": "../_esm/core/Abi.js"
}

6
node_modules/ox/AbiConstructor/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiConstructor.d.ts",
"main": "../_cjs/core/AbiConstructor.js",
"module": "../_esm/core/AbiConstructor.js"
}

6
node_modules/ox/AbiError/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiError.d.ts",
"main": "../_cjs/core/AbiError.js",
"module": "../_esm/core/AbiError.js"
}

6
node_modules/ox/AbiEvent/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiEvent.d.ts",
"main": "../_cjs/core/AbiEvent.js",
"module": "../_esm/core/AbiEvent.js"
}

6
node_modules/ox/AbiFunction/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiFunction.d.ts",
"main": "../_cjs/core/AbiFunction.js",
"module": "../_esm/core/AbiFunction.js"
}

6
node_modules/ox/AbiItem/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiItem.d.ts",
"main": "../_cjs/core/AbiItem.js",
"module": "../_esm/core/AbiItem.js"
}

6
node_modules/ox/AbiParameters/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AbiParameters.d.ts",
"main": "../_cjs/core/AbiParameters.js",
"module": "../_esm/core/AbiParameters.js"
}

6
node_modules/ox/AccessList/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AccessList.d.ts",
"main": "../_cjs/core/AccessList.js",
"module": "../_esm/core/AccessList.js"
}

6
node_modules/ox/AccountProof/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AccountProof.d.ts",
"main": "../_cjs/core/AccountProof.js",
"module": "../_esm/core/AccountProof.js"
}

6
node_modules/ox/Address/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Address.d.ts",
"main": "../_cjs/core/Address.js",
"module": "../_esm/core/Address.js"
}

6
node_modules/ox/AesGcm/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/AesGcm.d.ts",
"main": "../_cjs/core/AesGcm.js",
"module": "../_esm/core/AesGcm.js"
}

6
node_modules/ox/Authorization/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Authorization.d.ts",
"main": "../_cjs/core/Authorization.js",
"module": "../_esm/core/Authorization.js"
}

6
node_modules/ox/Base58/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Base58.d.ts",
"main": "../_cjs/core/Base58.js",
"module": "../_esm/core/Base58.js"
}

6
node_modules/ox/Base64/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Base64.d.ts",
"main": "../_cjs/core/Base64.js",
"module": "../_esm/core/Base64.js"
}

6
node_modules/ox/BinaryStateTree/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/BinaryStateTree.d.ts",
"main": "../_cjs/core/BinaryStateTree.js",
"module": "../_esm/core/BinaryStateTree.js"
}

6
node_modules/ox/Blobs/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Blobs.d.ts",
"main": "../_cjs/core/Blobs.js",
"module": "../_esm/core/Blobs.js"
}

6
node_modules/ox/Block/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Block.d.ts",
"main": "../_cjs/core/Block.js",
"module": "../_esm/core/Block.js"
}

6
node_modules/ox/BlockOverrides/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/BlockOverrides.d.ts",
"main": "../_cjs/core/BlockOverrides.js",
"module": "../_esm/core/BlockOverrides.js"
}

6
node_modules/ox/Bloom/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Bloom.d.ts",
"main": "../_cjs/core/Bloom.js",
"module": "../_esm/core/Bloom.js"
}

6
node_modules/ox/Bls/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Bls.d.ts",
"main": "../_cjs/core/Bls.js",
"module": "../_esm/core/Bls.js"
}

6
node_modules/ox/BlsPoint/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/BlsPoint.d.ts",
"main": "../_cjs/core/BlsPoint.js",
"module": "../_esm/core/BlsPoint.js"
}

6
node_modules/ox/Bytes/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Bytes.d.ts",
"main": "../_cjs/core/Bytes.js",
"module": "../_esm/core/Bytes.js"
}

195
node_modules/ox/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,195 @@
# ox
## 0.6.9
### Patch Changes
- [`6480607`](https://github.com/wevm/ox/commit/6480607767387a64f720e0fa3abbc26ea9409990) Thanks [@jxom](https://github.com/jxom)! - Fixed `AbiEvent.encode` for zeroish arguments.
## 0.6.8
### Patch Changes
- [#60](https://github.com/wevm/ox/pull/60) [`7ff54a2`](https://github.com/wevm/ox/commit/7ff54a2d0a77e2af5a2cc0e1095f0f8d952510c8) Thanks [@jxom](https://github.com/jxom)! - Added `BinaryStateTree` (EIP-7864) module.
## 0.6.7
### Patch Changes
- [`076c6a2`](https://github.com/wevm/ox/commit/076c6a260bfd42d6e66a7490bfb36425f91099d7) Thanks [@jxom](https://github.com/jxom)! - Removed redundant pure annotation.
## 0.6.6
### Patch Changes
- [`980f0e2`](https://github.com/wevm/ox/commit/980f0e269cca1ef3c564aba75055fef867ca3e6f) Thanks [@jxom](https://github.com/jxom)! - Fixed TSDoc.
## 0.6.5
### Patch Changes
- [`0b5182f`](https://github.com/wevm/ox/commit/0b5182f94821715c227dc8b0c891d4548b30fa0e) Thanks [@jxom](https://github.com/jxom)! - Fixed build process for typedef generation.
## 0.6.4
### Patch Changes
- [`74ceae4`](https://github.com/wevm/ox/commit/74ceae4089663ebae18690a44fd98accc28b9b5c) Thanks [@jxom](https://github.com/jxom)! - Fixed `Provider.parseError` behavior.
## 0.6.3
### Patch Changes
- [`ddaed51`](https://github.com/wevm/ox/commit/ddaed51550308eceda3c9a080503cf1fdfac6ac0) Thanks [@jxom](https://github.com/jxom)! - Fixed parsing of Provider RPC errors.
## 0.6.2
### Patch Changes
- [`e541cec`](https://github.com/wevm/ox/commit/e541ceca3c00f0d0b2fbd239696476934dc13ea3) Thanks [@jxom](https://github.com/jxom)! - Modified fallback RPC Errors to `RpcResponse.InternalError`.
## 0.6.1
### Patch Changes
- [`5d007ae`](https://github.com/wevm/ox/commit/5d007aebab4a7fe6acc8eb3cfecbce59fe79a00b) Thanks [@jxom](https://github.com/jxom)! - Added `RpcResponse.parseErrorObject` and `Provider.parseErrorObject`.
## 0.6.0
### Minor Changes
- [`94ec558`](https://github.com/wevm/ox/commit/94ec558c3f56d3254080be520a0d257e8b5d42c2) Thanks [@jxom](https://github.com/jxom)! - Added `BlockOverrides` & `StateOverrides` modules.
- [`94ec558`](https://github.com/wevm/ox/commit/94ec558c3f56d3254080be520a0d257e8b5d42c2) Thanks [@jxom](https://github.com/jxom)! - Added `eth_simulateV1` to `eth_` RPC schema.
## 0.5.0
### Minor Changes
- [`1406e22`](https://github.com/wevm/ox/commit/1406e224d0527732885fdb7737ed2f0dc41929ef) Thanks [@jxom](https://github.com/jxom)! - Added ERC-4337 utilities.
## 0.4.4
### Patch Changes
- [#45](https://github.com/wevm/ox/pull/45) [`48b896f`](https://github.com/wevm/ox/commit/48b896f3c491bcf9e0d8460857b278ede74eaf9e) Thanks [@deodad](https://github.com/deodad)! - Ensured addresses are checksummed when creating SIWE messages
## 0.4.3
### Patch Changes
- [`c09d165`](https://github.com/wevm/ox/commit/c09d1655a1fa65be33d0dfb86d14cfe0dad7bdc3) Thanks [@jxom](https://github.com/jxom)! - Added `checksumAddress` as an option to `AbiParameters.{encode|decode}`.
## 0.4.2
### Patch Changes
- [#40](https://github.com/wevm/ox/pull/40) [`47e306d`](https://github.com/wevm/ox/commit/47e306d8ab95140eb7e2589c05351d1663a507ae) Thanks [@jxom](https://github.com/jxom)! - **ox/erc6492:** Added universal signature verification exports.
## 0.4.1
### Patch Changes
- [#37](https://github.com/wevm/ox/pull/37) [`39604df`](https://github.com/wevm/ox/commit/39604df9f84b810322e12f767ef450c0c2ced308) Thanks [@jxom](https://github.com/jxom)! - Added `ox/erc6492` entrypoint.
## 0.4.0
### Minor Changes
- [#35](https://github.com/wevm/ox/pull/35) [`4680b06`](https://github.com/wevm/ox/commit/4680b06d4715b1b62d903f45490d325506a1e959) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Updated `Signature.toHex` to serialize the last byte as `v` instead of `yParity` for widened compatibility.
### Patch Changes
- [`15f9863`](https://github.com/wevm/ox/commit/15f98630c46ec0c09998162a92a5e8bac709e32d) Thanks [@jxom](https://github.com/jxom)! - Added assertion for ABI-encoding integer ranges.
- [`2e0d4af`](https://github.com/wevm/ox/commit/2e0d4af5c6e26c09a9b83971be0fc06415ee4976) Thanks [@jxom](https://github.com/jxom)! - Added support for block identifiers.
## 0.3.1
### Patch Changes
- [`e4104cd`](https://github.com/wevm/ox/commit/e4104cdb217de1fa30480b40060eb0fb0f7ad8d5) Thanks [@jxom](https://github.com/jxom)! - Added `extraEntropy` option to `Secp256k1.sign` & `P256.sign`.
## 0.3.0
### Minor Changes
- [`9ad0d2c`](https://github.com/wevm/ox/commit/9ad0d2c9777b5c6a8c1cd64ad8742f9c05706606) Thanks [@jxom](https://github.com/jxom)! - Added extra entropy to signature generation.
## 0.2.2
### Patch Changes
- [`4f40358`](https://github.com/wevm/ox/commit/4f4035826313dce974b7c7fa64ba4ea20d1f7f61) Thanks [@jxom](https://github.com/jxom)! - Tweaked `RpcResponse` and `Provider` errors to have optional parameters.
## 0.2.1
### Patch Changes
- [`6e4b635`](https://github.com/wevm/ox/commit/6e4b635ee720312be6631dee4f24fdd3c066f2eb) Thanks [@jxom](https://github.com/jxom)! - Derive EIP-712 Domain type if not provided in `TypedData.serialize`.
## 0.2.0
### Minor Changes
- [`2f0fc9b`](https://github.com/wevm/ox/commit/2f0fc9b66ff70bf03a3ecf146ed1a62433f53eb8) Thanks [@jxom](https://github.com/jxom)! - **Breaking:** Removed `.parseError` property on functions. Use the `.ErrorType` property instead. [Example](https://oxlib.sh/error-handling#usage-with-neverthrow)
### Patch Changes
- [`af01579`](https://github.com/wevm/ox/commit/af01579951b898ebd659cd6b64aaa56f7733c191) Thanks [@jxom](https://github.com/jxom)! - Assert that EIP-712 domains are valid.
## 0.1.8
### Patch Changes
- [#25](https://github.com/wevm/ox/pull/25) [`5da9efb`](https://github.com/wevm/ox/commit/5da9efbfebfa738ee0f78927e90b3fab61cbb2e8) Thanks [@tmm](https://github.com/tmm)! - Shimmed `WebAuthnP256.createCredential` for 1Password Firefox Add-on.
## 0.1.7
### Patch Changes
- [`33b5123`](https://github.com/wevm/ox/commit/33b51236908f17cb8644a47e222995e1800853db) Thanks [@tmm](https://github.com/tmm)! - Updated Provider errors.
## 0.1.6
### Patch Changes
- [`4405c4b`](https://github.com/wevm/ox/commit/4405c4bd2bff3f9f222a90de7323cce77c94b5f3) Thanks [@jxom](https://github.com/jxom)! - Amended `accountsChanged` parameter to be `readonly`.
- [#22](https://github.com/wevm/ox/pull/22) [`23f2d61`](https://github.com/wevm/ox/commit/23f2d61f817c5d33f0053cb154447f0b26244cc1) Thanks [@tmm](https://github.com/tmm)! - Added EIP 1193 errors.
## 0.1.5
### Patch Changes
- [`644b96a`](https://github.com/wevm/ox/commit/644b96a169a118c6f0606eda5354785523ed099b) Thanks [@jxom](https://github.com/jxom)! - Added additional guard for `result` in `Provider.from`.
## 0.1.4
### Patch Changes
- [`777fe42`](https://github.com/wevm/ox/commit/777fe4249c5225c676ff690fda58c5fcfb35d1f0) Thanks [@jxom](https://github.com/jxom)! - Tweaked `trimLeft` to remove all leading zeros.
## 0.1.3
### Patch Changes
- [`868d431`](https://github.com/wevm/ox/commit/868d4319a8cda77345f85f9f2e88ca786f0c8cfe) Thanks [@jxom](https://github.com/jxom)! - Added handling for odd-length hex values.
## 0.1.2
### Patch Changes
- [#17](https://github.com/wevm/ox/pull/17) [`f438faf`](https://github.com/wevm/ox/commit/f438fafbd396248283876eba220f4c661c47bfd2) Thanks [@jxom](https://github.com/jxom)! - Moved modules to `core/`.
## 0.1.1
### Patch Changes
- [`b7de4f2`](https://github.com/wevm/ox/commit/b7de4f2180520fd7f2bf08955df6e676d75db93e) Thanks [@jxom](https://github.com/jxom)! - Fixed `RpcSchema` inference on `params`.
## 0.1.0
### Minor Changes
- [`4297bcf`](https://github.com/wevm/ox/commit/4297bcf0acef7f1f208ba3770d679fefa0c2cb8d) Thanks [@jxom](https://github.com/jxom)! - Initial release.

6
node_modules/ox/Caches/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Caches.d.ts",
"main": "../_cjs/core/Caches.js",
"module": "../_esm/core/Caches.js"
}

6
node_modules/ox/ContractAddress/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/ContractAddress.d.ts",
"main": "../_cjs/core/ContractAddress.js",
"module": "../_esm/core/ContractAddress.js"
}

6
node_modules/ox/Ens/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Ens.d.ts",
"main": "../_cjs/core/Ens.js",
"module": "../_esm/core/Ens.js"
}

6
node_modules/ox/Errors/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Errors.d.ts",
"main": "../_cjs/core/Errors.js",
"module": "../_esm/core/Errors.js"
}

6
node_modules/ox/Fee/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Fee.d.ts",
"main": "../_cjs/core/Fee.js",
"module": "../_esm/core/Fee.js"
}

6
node_modules/ox/Filter/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Filter.d.ts",
"main": "../_cjs/core/Filter.js",
"module": "../_esm/core/Filter.js"
}

6
node_modules/ox/Hash/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Hash.d.ts",
"main": "../_cjs/core/Hash.js",
"module": "../_esm/core/Hash.js"
}

6
node_modules/ox/HdKey/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/HdKey.d.ts",
"main": "../_cjs/core/HdKey.js",
"module": "../_esm/core/HdKey.js"
}

6
node_modules/ox/Hex/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Hex.d.ts",
"main": "../_cjs/core/Hex.js",
"module": "../_esm/core/Hex.js"
}

6
node_modules/ox/Json/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Json.d.ts",
"main": "../_cjs/core/Json.js",
"module": "../_esm/core/Json.js"
}

6
node_modules/ox/Kzg/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Kzg.d.ts",
"main": "../_cjs/core/Kzg.js",
"module": "../_esm/core/Kzg.js"
}

21
node_modules/ox/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023-present wevm
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

6
node_modules/ox/Log/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Log.d.ts",
"main": "../_cjs/core/Log.js",
"module": "../_esm/core/Log.js"
}

6
node_modules/ox/Mnemonic/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Mnemonic.d.ts",
"main": "../_cjs/core/Mnemonic.js",
"module": "../_esm/core/Mnemonic.js"
}

6
node_modules/ox/P256/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/P256.d.ts",
"main": "../_cjs/core/P256.js",
"module": "../_esm/core/P256.js"
}

6
node_modules/ox/PersonalMessage/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/PersonalMessage.d.ts",
"main": "../_cjs/core/PersonalMessage.js",
"module": "../_esm/core/PersonalMessage.js"
}

6
node_modules/ox/Provider/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Provider.d.ts",
"main": "../_cjs/core/Provider.js",
"module": "../_esm/core/Provider.js"
}

6
node_modules/ox/PublicKey/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/PublicKey.d.ts",
"main": "../_cjs/core/PublicKey.js",
"module": "../_esm/core/PublicKey.js"
}

93
node_modules/ox/README.md generated vendored Normal file
View File

@@ -0,0 +1,93 @@
<br/>
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/wevm/ox/blob/main/.github/ox-dark.svg">
<img alt="ox logo" src="https://github.com/wevm/ox/blob/main/.github/ox-light.svg" width="auto" height="200">
</picture>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/ox">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/ox?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/v/ox?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
</picture>
</a>
<a href="https://github.com/wevm/ox/blob/main/LICENSE">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/ox?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/l/ox?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="MIT License">
</picture>
</a>
<a href="https://app.codecov.io/gh/wevm/ox">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/codecov/c/github/wevm/ox?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/codecov/c/github/wevm/ox?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Code coverage">
</picture>
</a>
</p>
## Overview
Ox (⦻) is the foundation of robust Ethereum software written in TypeScript. It is an Ethereum Standard Library that provides a set of lightweight, performant, and type-safe TypeScript modules for Ethereum.
It offers core utilities & types for primitives such as: ABIs, Addresses, Blocks, Bytes, ECDSA, Hex, JSON-RPC, RLP, Signing & Signatures, Transaction Envelopes, and more.
As an unopinionated Standard Library, it is designed to be used by higher-level consumers (such as [Viem](https://viem.sh), [Tevm](https://tevm.sh), or their alternatives) to provide their own opinionated interfaces, and/or when reaching for low-level primitives may be needed without buying into a Client Abstraction stack (Viem, Ethers, Web3.js, etc).
## Documentation
[Head to the documentation](https://oxlib.sh) to read and learn more about Ox.
## Example Usage
The example below demonstrates how to construct, sign, and broadcast a transaction envelope using Ox:
```ts
import { Provider, Secp256k1, TransactionEnvelopeEip1559, Value } from 'ox'
// 1. Construct a transaction envelope.
const envelope = TransactionEnvelopeEip1559.from({
chainId: 1,
gas: 21000n,
nonce: 0n,
maxFeePerGas: Value.fromGwei('10'),
maxPriorityFeePerGas: Value.fromGwei('1'),
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
value: Value.fromEther('1'),
})
// 2. Get the signing payload for the envelope.
const payload = TransactionEnvelopeEip1559.getSignPayload(envelope)
// 3. Sign the payload with your private key using secp256k1.
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
// 4. Serialize the envelope with the signature.
const serialized = TransactionEnvelopeEip1559.serialize(envelope, { signature })
// 5. Broadcast the envelope to the network.
const provider = Provider.from(window.ethereum)
const hash = await provider.request({
method: 'eth_sendRawTransaction',
params: [serialized],
})
```
> [!NOTE]
> Ox's APIs are purposely stateless, unopinionated, and verbose. The example above can definitely be achieved in a few lines of code in a more concise manner, however, the goal is for higher-level abstractions (Viem, etc) built on top of Ox to handle this for you.
## Community
Check out the following places for more Ox-related content:
- Follow [@wevm_dev](https://x.com/wevm_dev), [@jxom](https://x.com/_jxom), and [@awkweb](https://x.com/awkweb) on Twitter for project updates
- Join the [discussions on GitHub](https://github.com/wevm/ox/discussions)
## Support
- [GitHub Sponsors](https://github.com/sponsors/wevm?metadata_campaign=docs_support)
- [Gitcoin Grant](https://wagmi.sh/gitcoin)
- [wevm.eth](https://etherscan.io/enslookup-search?search=wevm.eth)

6
node_modules/ox/Rlp/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Rlp.d.ts",
"main": "../_cjs/core/Rlp.js",
"module": "../_esm/core/Rlp.js"
}

6
node_modules/ox/RpcRequest/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/RpcRequest.d.ts",
"main": "../_cjs/core/RpcRequest.js",
"module": "../_esm/core/RpcRequest.js"
}

6
node_modules/ox/RpcResponse/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/RpcResponse.d.ts",
"main": "../_cjs/core/RpcResponse.js",
"module": "../_esm/core/RpcResponse.js"
}

6
node_modules/ox/RpcSchema/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/RpcSchema.d.ts",
"main": "../_cjs/core/RpcSchema.js",
"module": "../_esm/core/RpcSchema.js"
}

6
node_modules/ox/RpcTransport/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/RpcTransport.d.ts",
"main": "../_cjs/core/RpcTransport.js",
"module": "../_esm/core/RpcTransport.js"
}

6
node_modules/ox/Secp256k1/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Secp256k1.d.ts",
"main": "../_cjs/core/Secp256k1.js",
"module": "../_esm/core/Secp256k1.js"
}

6
node_modules/ox/Signature/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Signature.d.ts",
"main": "../_cjs/core/Signature.js",
"module": "../_esm/core/Signature.js"
}

6
node_modules/ox/Siwe/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Siwe.d.ts",
"main": "../_cjs/core/Siwe.js",
"module": "../_esm/core/Siwe.js"
}

6
node_modules/ox/Solidity/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Solidity.d.ts",
"main": "../_cjs/core/Solidity.js",
"module": "../_esm/core/Solidity.js"
}

6
node_modules/ox/StateOverrides/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/StateOverrides.d.ts",
"main": "../_cjs/core/StateOverrides.js",
"module": "../_esm/core/StateOverrides.js"
}

6
node_modules/ox/Transaction/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Transaction.d.ts",
"main": "../_cjs/core/Transaction.js",
"module": "../_esm/core/Transaction.js"
}

6
node_modules/ox/TransactionEnvelope/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelope.d.ts",
"main": "../_cjs/core/TransactionEnvelope.js",
"module": "../_esm/core/TransactionEnvelope.js"
}

View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelopeEip1559.d.ts",
"main": "../_cjs/core/TransactionEnvelopeEip1559.js",
"module": "../_esm/core/TransactionEnvelopeEip1559.js"
}

View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelopeEip2930.d.ts",
"main": "../_cjs/core/TransactionEnvelopeEip2930.js",
"module": "../_esm/core/TransactionEnvelopeEip2930.js"
}

View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelopeEip4844.d.ts",
"main": "../_cjs/core/TransactionEnvelopeEip4844.js",
"module": "../_esm/core/TransactionEnvelopeEip4844.js"
}

View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelopeEip7702.d.ts",
"main": "../_cjs/core/TransactionEnvelopeEip7702.js",
"module": "../_esm/core/TransactionEnvelopeEip7702.js"
}

View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionEnvelopeLegacy.d.ts",
"main": "../_cjs/core/TransactionEnvelopeLegacy.js",
"module": "../_esm/core/TransactionEnvelopeLegacy.js"
}

6
node_modules/ox/TransactionReceipt/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionReceipt.d.ts",
"main": "../_cjs/core/TransactionReceipt.js",
"module": "../_esm/core/TransactionReceipt.js"
}

6
node_modules/ox/TransactionRequest/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TransactionRequest.d.ts",
"main": "../_cjs/core/TransactionRequest.js",
"module": "../_esm/core/TransactionRequest.js"
}

6
node_modules/ox/TypedData/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/TypedData.d.ts",
"main": "../_cjs/core/TypedData.js",
"module": "../_esm/core/TypedData.js"
}

6
node_modules/ox/ValidatorData/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/ValidatorData.d.ts",
"main": "../_cjs/core/ValidatorData.js",
"module": "../_esm/core/ValidatorData.js"
}

6
node_modules/ox/Value/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Value.d.ts",
"main": "../_cjs/core/Value.js",
"module": "../_esm/core/Value.js"
}

6
node_modules/ox/WebAuthnP256/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/WebAuthnP256.d.ts",
"main": "../_cjs/core/WebAuthnP256.js",
"module": "../_esm/core/WebAuthnP256.js"
}

6
node_modules/ox/WebCryptoP256/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/WebCryptoP256.d.ts",
"main": "../_cjs/core/WebCryptoP256.js",
"module": "../_esm/core/WebCryptoP256.js"
}

6
node_modules/ox/Withdrawal/package.json generated vendored Normal file
View File

@@ -0,0 +1,6 @@
{
"type": "module",
"types": "../_types/core/Withdrawal.d.ts",
"main": "../_cjs/core/Withdrawal.js",
"module": "../_esm/core/Withdrawal.js"
}

15
node_modules/ox/_cjs/core/Abi.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.format = format;
exports.from = from;
const abitype = require("abitype");
const internal = require("./internal/abi.js");
function format(abi) {
return abitype.formatAbi(abi);
}
function from(abi) {
if (internal.isSignatures(abi))
return abitype.parseAbi(abi);
return abi;
}
//# sourceMappingURL=Abi.js.map

1
node_modules/ox/_cjs/core/Abi.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Abi.js","sourceRoot":"","sources":["../../core/Abi.ts"],"names":[],"mappings":";;AA8CA,wBAEC;AA+FD,oBAGC;AAlJD,mCAAkC;AAElC,8CAA6C;AA4C7C,SAAgB,MAAM,CAAC,GAA6B;IAClD,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAU,CAAA;AACxC,CAAC;AA+FD,SAAgB,IAAI,CAAC,GAA4B;IAC/C,IAAI,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC5D,OAAO,GAAG,CAAA;AACZ,CAAC"}

37
node_modules/ox/_cjs/core/AbiConstructor.js generated vendored Normal file
View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decode = decode;
exports.encode = encode;
exports.format = format;
exports.from = from;
exports.fromAbi = fromAbi;
const abitype = require("abitype");
const AbiItem = require("./AbiItem.js");
const AbiParameters = require("./AbiParameters.js");
const Hex = require("./Hex.js");
function decode(abiConstructor, options) {
const { bytecode } = options;
if (abiConstructor.inputs.length === 0)
return undefined;
const data = options.data.replace(bytecode, '0x');
return AbiParameters.decode(abiConstructor.inputs, data);
}
function encode(abiConstructor, options) {
const { bytecode, args } = options;
return Hex.concat(bytecode, abiConstructor.inputs?.length && args?.length
? AbiParameters.encode(abiConstructor.inputs, args)
: '0x');
}
function format(abiConstructor) {
return abitype.formatAbiItem(abiConstructor);
}
function from(abiConstructor) {
return AbiItem.from(abiConstructor);
}
function fromAbi(abi) {
const item = abi.find((item) => item.type === 'constructor');
if (!item)
throw new AbiItem.NotFoundError({ name: 'constructor' });
return item;
}
//# sourceMappingURL=AbiConstructor.js.map

1
node_modules/ox/_cjs/core/AbiConstructor.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AbiConstructor.js","sourceRoot":"","sources":["../../core/AbiConstructor.ts"],"names":[],"mappings":";;AAgDA,wBAQC;AA0ED,wBAWC;AA4DD,wBAEC;AA2HD,oBAIC;AAiDD,0BAIC;AA/XD,mCAAkC;AAElC,wCAAuC;AACvC,oDAAmD;AAEnD,gCAA+B;AA2C/B,SAAgB,MAAM,CACpB,cAA8B,EAC9B,OAAuB;IAEvB,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAC5B,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAY,CAAA;IAC5D,OAAO,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AAC1D,CAAC;AA0ED,SAAgB,MAAM,CACpB,cAA8B,EAC9B,OAAuC;IAEvC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAA;IAClC,OAAO,GAAG,CAAC,MAAM,CACf,QAAQ,EACR,cAAc,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,EAAE,MAAM;QAC3C,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAA0B,CAAC;QACzE,CAAC,CAAC,IAAI,CACT,CAAA;AACH,CAAC;AA4DD,SAAgB,MAAM,CAAC,cAA8B;IACnD,OAAO,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAA;AAC9C,CAAC;AA2HD,SAAgB,IAAI,CAClB,cAA2D;IAE3D,OAAO,OAAO,CAAC,IAAI,CAAC,cAAgC,CAAC,CAAA;AACvD,CAAC;AAiDD,SAAgB,OAAO,CAAC,GAAiC;IACvD,MAAM,IAAI,GAAI,GAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,CAAA;IACzE,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IACnE,OAAO,IAAI,CAAA;AACb,CAAC"}

93
node_modules/ox/_cjs/core/AbiError.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.solidityPanicSelector = exports.solidityPanic = exports.solidityErrorSelector = exports.solidityError = exports.panicReasons = void 0;
exports.decode = decode;
exports.encode = encode;
exports.format = format;
exports.from = from;
exports.fromAbi = fromAbi;
exports.getSelector = getSelector;
const abitype = require("abitype");
const AbiItem = require("./AbiItem.js");
const AbiParameters = require("./AbiParameters.js");
const Hex = require("./Hex.js");
function decode(abiError, data, options = {}) {
if (Hex.size(data) < 4)
throw new AbiItem.InvalidSelectorSizeError({ data });
if (abiError.inputs.length === 0)
return undefined;
const values = AbiParameters.decode(abiError.inputs, Hex.slice(data, 4), options);
if (values && Object.keys(values).length === 1) {
if (Array.isArray(values))
return values[0];
return Object.values(values)[0];
}
return values;
}
function encode(abiError, ...args) {
const selector = getSelector(abiError);
const data = args.length > 0
? AbiParameters.encode(abiError.inputs, args[0])
: undefined;
return data ? Hex.concat(selector, data) : selector;
}
function format(abiError) {
return abitype.formatAbiItem(abiError);
}
function from(abiError, options = {}) {
return AbiItem.from(abiError, options);
}
function fromAbi(abi, name, options) {
if (name === 'Error')
return exports.solidityError;
if (name === 'Panic')
return exports.solidityPanic;
if (Hex.validate(name, { strict: false })) {
const selector = Hex.slice(name, 0, 4);
if (selector === exports.solidityErrorSelector)
return exports.solidityError;
if (selector === exports.solidityPanicSelector)
return exports.solidityPanic;
}
const item = AbiItem.fromAbi(abi, name, options);
if (item.type !== 'error')
throw new AbiItem.NotFoundError({ name, type: 'error' });
return item;
}
function getSelector(abiItem) {
return AbiItem.getSelector(abiItem);
}
exports.panicReasons = {
1: 'An `assert` condition failed.',
17: 'Arithmetic operation resulted in underflow or overflow.',
18: 'Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).',
33: 'Attempted to convert to an invalid type.',
34: 'Attempted to access a storage byte array that is incorrectly encoded.',
49: 'Performed `.pop()` on an empty array',
50: 'Array index is out of bounds.',
65: 'Allocated too much memory or created an array which is too large.',
81: 'Attempted to call a zero-initialized variable of internal function type.',
};
exports.solidityError = from({
inputs: [
{
name: 'message',
type: 'string',
},
],
name: 'Error',
type: 'error',
});
exports.solidityErrorSelector = '0x08c379a0';
exports.solidityPanic = from({
inputs: [
{
name: 'reason',
type: 'uint8',
},
],
name: 'Panic',
type: 'error',
});
exports.solidityPanicSelector = '0x4e487b71';
//# sourceMappingURL=AbiError.js.map

1
node_modules/ox/_cjs/core/AbiError.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AbiError.js","sourceRoot":"","sources":["../../core/AbiError.ts"],"names":[],"mappings":";;;AAmJA,wBAkBC;AA4FD,wBAYC;AAkDD,wBAIC;AAkGD,oBAcC;AAmFD,0BA8BC;AAqDD,kCAEC;AA3lBD,mCAAkC;AAElC,wCAAuC;AACvC,oDAAmD;AAEnD,gCAA+B;AA8I/B,SAAgB,MAAM,CACpB,QAAkB,EAClB,IAAa,EACb,UAA0B,EAAE;IAE5B,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,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,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;SACf;KACF;IACD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CACd,CAAC,CAAA;AAEW,QAAA,qBAAqB,GAAG,YAAY,CAAA;AAEpC,QAAA,aAAa,GAAiB,IAAI,CAAC;IAC9C,MAAM,EAAE;QACN;YACE,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,OAAO;SACd;KACF;IACD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;CACd,CAAC,CAAA;AAEW,QAAA,qBAAqB,GAAG,YAAY,CAAA"}

333
node_modules/ox/_cjs/core/AbiEvent.js generated vendored Normal file
View File

@@ -0,0 +1,333 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FilterTypeNotSupportedError = exports.SelectorTopicMismatchError = exports.TopicsMismatchError = exports.DataMismatchError = exports.InputNotFoundError = exports.ArgsMismatchError = void 0;
exports.assertArgs = assertArgs;
exports.decode = decode;
exports.encode = encode;
exports.format = format;
exports.from = from;
exports.fromAbi = fromAbi;
exports.getSelector = getSelector;
const abitype = require("abitype");
const AbiItem = require("./AbiItem.js");
const AbiParameters = require("./AbiParameters.js");
const Address = require("./Address.js");
const Bytes = require("./Bytes.js");
const Errors = require("./Errors.js");
const Hash = require("./Hash.js");
const Hex = require("./Hex.js");
const Cursor = require("./internal/cursor.js");
const errors_js_1 = require("./internal/errors.js");
function assertArgs(abiEvent, args, matchArgs) {
if (!args || !matchArgs)
throw new ArgsMismatchError({
abiEvent,
expected: args,
given: matchArgs,
});
function isEqual(input, value, arg) {
if (input.type === 'address')
return Address.isEqual(value, arg);
if (input.type === 'string')
return Hash.keccak256(Bytes.fromString(value)) === arg;
if (input.type === 'bytes')
return Hash.keccak256(value) === arg;
return value === arg;
}
if (Array.isArray(args) && Array.isArray(matchArgs)) {
for (const [index, value] of matchArgs.entries()) {
if (value === null || value === undefined)
continue;
const input = abiEvent.inputs[index];
if (!input)
throw new InputNotFoundError({
abiEvent,
name: `${index}`,
});
const value_ = Array.isArray(value) ? value : [value];
let equal = false;
for (const value of value_) {
if (isEqual(input, value, args[index]))
equal = true;
}
if (!equal)
throw new ArgsMismatchError({
abiEvent,
expected: args,
given: matchArgs,
});
}
}
if (typeof args === 'object' &&
!Array.isArray(args) &&
typeof matchArgs === 'object' &&
!Array.isArray(matchArgs))
for (const [key, value] of Object.entries(matchArgs)) {
if (value === null || value === undefined)
continue;
const input = abiEvent.inputs.find((input) => input.name === key);
if (!input)
throw new InputNotFoundError({ abiEvent, name: key });
const value_ = Array.isArray(value) ? value : [value];
let equal = false;
for (const value of value_) {
if (isEqual(input, value, args[key]))
equal = true;
}
if (!equal)
throw new ArgsMismatchError({
abiEvent,
expected: args,
given: matchArgs,
});
}
}
function decode(abiEvent, log) {
const { data, topics } = log;
const [selector_, ...argTopics] = topics;
const selector = getSelector(abiEvent);
if (selector_ !== selector)
throw new SelectorTopicMismatchError({
abiEvent,
actual: selector_,
expected: selector,
});
const { inputs } = abiEvent;
const isUnnamed = inputs?.every((x) => !('name' in x && x.name));
let args = isUnnamed ? [] : {};
const indexedInputs = inputs.filter((x) => 'indexed' in x && x.indexed);
for (let i = 0; i < indexedInputs.length; i++) {
const param = indexedInputs[i];
const topic = argTopics[i];
if (!topic)
throw new TopicsMismatchError({
abiEvent,
param: param,
});
args[isUnnamed ? i : param.name || i] = (() => {
if (param.type === 'string' ||
param.type === 'bytes' ||
param.type === 'tuple' ||
param.type.match(/^(.*)\[(\d+)?\]$/))
return topic;
const decoded = AbiParameters.decode([param], topic) || [];
return decoded[0];
})();
}
const nonIndexedInputs = inputs.filter((x) => !('indexed' in x && x.indexed));
if (nonIndexedInputs.length > 0) {
if (data && data !== '0x') {
try {
const decodedData = AbiParameters.decode(nonIndexedInputs, data);
if (decodedData) {
if (isUnnamed)
args = [...args, ...decodedData];
else {
for (let i = 0; i < nonIndexedInputs.length; i++) {
const index = inputs.indexOf(nonIndexedInputs[i]);
args[nonIndexedInputs[i].name || index] = decodedData[i];
}
}
}
}
catch (err) {
if (err instanceof AbiParameters.DataSizeTooSmallError ||
err instanceof Cursor.PositionOutOfBoundsError)
throw new DataMismatchError({
abiEvent,
data: data,
parameters: nonIndexedInputs,
size: Hex.size(data),
});
throw err;
}
}
else {
throw new DataMismatchError({
abiEvent,
data: '0x',
parameters: nonIndexedInputs,
size: 0,
});
}
}
return Object.values(args).length > 0 ? args : undefined;
}
function encode(abiEvent, ...[args]) {
let topics = [];
if (args && abiEvent.inputs) {
const indexedInputs = abiEvent.inputs.filter((param) => 'indexed' in param && param.indexed);
const args_ = Array.isArray(args)
? args
: Object.values(args).length > 0
? indexedInputs?.map((x, i) => args[x.name ?? i]) ?? []
: [];
if (args_.length > 0) {
const encode = (param, value) => {
if (param.type === 'string')
return Hash.keccak256(Hex.fromString(value));
if (param.type === 'bytes')
return Hash.keccak256(value);
if (param.type === 'tuple' || param.type.match(/^(.*)\[(\d+)?\]$/))
throw new FilterTypeNotSupportedError(param.type);
return AbiParameters.encode([param], [value]);
};
topics =
indexedInputs?.map((param, i) => {
if (Array.isArray(args_[i]))
return args_[i].map((_, j) => encode(param, args_[i][j]));
return typeof args_[i] !== 'undefined' && args_[i] !== null
? encode(param, args_[i])
: null;
}) ?? [];
}
}
const selector = (() => {
if (abiEvent.hash)
return abiEvent.hash;
return getSelector(abiEvent);
})();
return { topics: [selector, ...topics] };
}
function format(abiEvent) {
return abitype.formatAbiItem(abiEvent);
}
function from(abiEvent, options = {}) {
return AbiItem.from(abiEvent, options);
}
function fromAbi(abi, name, options) {
const item = AbiItem.fromAbi(abi, name, options);
if (item.type !== 'event')
throw new AbiItem.NotFoundError({ name, type: 'event' });
return item;
}
function getSelector(abiItem) {
return AbiItem.getSignatureHash(abiItem);
}
class ArgsMismatchError extends Errors.BaseError {
constructor({ abiEvent, expected, given, }) {
super('Given arguments do not match the expected arguments.', {
metaMessages: [
`Event: ${format(abiEvent)}`,
`Expected Arguments: ${!expected ? 'None' : ''}`,
expected ? (0, errors_js_1.prettyPrint)(expected) : undefined,
`Given Arguments: ${!given ? 'None' : ''}`,
given ? (0, errors_js_1.prettyPrint)(given) : undefined,
],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.ArgsMismatchError'
});
}
}
exports.ArgsMismatchError = ArgsMismatchError;
class InputNotFoundError extends Errors.BaseError {
constructor({ abiEvent, name, }) {
super(`Parameter "${name}" not found on \`${format(abiEvent)}\`.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.InputNotFoundError'
});
}
}
exports.InputNotFoundError = InputNotFoundError;
class DataMismatchError extends Errors.BaseError {
constructor({ abiEvent, data, parameters, size, }) {
super([
`Data size of ${size} bytes is too small for non-indexed event parameters.`,
].join('\n'), {
metaMessages: [
`Non-indexed Parameters: (${AbiParameters.format(parameters)})`,
`Data: ${data} (${size} bytes)`,
],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.DataMismatchError'
});
Object.defineProperty(this, "abiEvent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "data", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "parameters", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "size", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.abiEvent = abiEvent;
this.data = data;
this.parameters = parameters;
this.size = size;
}
}
exports.DataMismatchError = DataMismatchError;
class TopicsMismatchError extends Errors.BaseError {
constructor({ abiEvent, param, }) {
super([
`Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ''} for "${format(abiEvent)}".`,
].join('\n'));
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.TopicsMismatchError'
});
Object.defineProperty(this, "abiEvent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.abiEvent = abiEvent;
}
}
exports.TopicsMismatchError = TopicsMismatchError;
class SelectorTopicMismatchError extends Errors.BaseError {
constructor({ abiEvent, actual, expected, }) {
super(`topics[0]="${actual}" does not match the expected topics[0]="${expected}".`, {
metaMessages: [`Event: ${format(abiEvent)}`, `Selector: ${expected}`],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.SelectorTopicMismatchError'
});
}
}
exports.SelectorTopicMismatchError = SelectorTopicMismatchError;
class FilterTypeNotSupportedError extends Errors.BaseError {
constructor(type) {
super(`Filter type "${type}" is not supported.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiEvent.FilterTypeNotSupportedError'
});
}
}
exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError;
//# sourceMappingURL=AbiEvent.js.map

1
node_modules/ox/_cjs/core/AbiEvent.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

80
node_modules/ox/_cjs/core/AbiFunction.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeData = decodeData;
exports.decodeResult = decodeResult;
exports.encodeData = encodeData;
exports.encodeResult = encodeResult;
exports.format = format;
exports.from = from;
exports.fromAbi = fromAbi;
exports.getSelector = getSelector;
const abitype = require("abitype");
const AbiItem = require("./AbiItem.js");
const AbiParameters = require("./AbiParameters.js");
const Hex = require("./Hex.js");
function decodeData(abiFunction, data) {
const { overloads } = abiFunction;
if (Hex.size(data) < 4)
throw new AbiItem.InvalidSelectorSizeError({ data });
if (abiFunction.inputs.length === 0)
return undefined;
const item = overloads
? fromAbi([abiFunction, ...overloads], data)
: abiFunction;
if (Hex.size(data) <= 4)
return undefined;
return AbiParameters.decode(item.inputs, Hex.slice(data, 4));
}
function decodeResult(abiFunction, data, options = {}) {
const values = AbiParameters.decode(abiFunction.outputs, data, options);
if (values && Object.keys(values).length === 0)
return undefined;
if (values && Object.keys(values).length === 1) {
if (Array.isArray(values))
return values[0];
return Object.values(values)[0];
}
return values;
}
function encodeData(abiFunction, ...args) {
const { overloads } = abiFunction;
const item = overloads
? fromAbi([abiFunction, ...overloads], abiFunction.name, {
args: args[0],
})
: abiFunction;
const selector = getSelector(item);
const data = args.length > 0
? AbiParameters.encode(item.inputs, args[0])
: undefined;
return data ? Hex.concat(selector, data) : selector;
}
function encodeResult(abiFunction, output, options = {}) {
const { as = 'Array' } = options;
const values = (() => {
if (abiFunction.outputs.length === 1)
return [output];
if (Array.isArray(output))
return output;
if (as === 'Object')
return Object.values(output);
return [output];
})();
return AbiParameters.encode(abiFunction.outputs, values);
}
function format(abiFunction) {
return abitype.formatAbiItem(abiFunction);
}
function from(abiFunction, options = {}) {
return AbiItem.from(abiFunction, options);
}
function fromAbi(abi, name, options) {
const item = AbiItem.fromAbi(abi, name, options);
if (item.type !== 'function')
throw new AbiItem.NotFoundError({ name, type: 'function' });
return item;
}
function getSelector(abiItem) {
return AbiItem.getSelector(abiItem);
}
//# sourceMappingURL=AbiFunction.js.map

1
node_modules/ox/_cjs/core/AbiFunction.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AbiFunction.js","sourceRoot":"","sources":["../../core/AbiFunction.ts"],"names":[],"mappings":";;AA+FA,gCAeC;AA0HD,oCAeC;AAqID,gCAoBC;AA6CD,oCAkBC;AAsDD,wBAIC;AA6GD,oBAcC;AAqFD,0BAsBC;AAoCD,kCAEC;AArxBD,mCAAkC;AAElC,wCAAuC;AACvC,oDAAmD;AAEnD,gCAA+B;AA0F/B,SAAgB,UAAU,CACxB,WAAkC,EAClC,IAAa;IAEb,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAA;IAEjC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,OAAO,CAAC,wBAAwB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5E,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,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AO,CASrB,GAAuC,EACvC,IAAsD,EACtD,OAKC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,OAAc,CAAC,CAAA;IACvD,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU;QAC1B,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA;IAC7D,OAAO,IAAa,CAAA;AACtB,CAAC;AAoCD,SAAgB,WAAW,CAAC,OAA6B;IACvD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}

174
node_modules/ox/_cjs/core/AbiItem.js generated vendored Normal file
View File

@@ -0,0 +1,174 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidSelectorSizeError = exports.NotFoundError = exports.AmbiguityError = void 0;
exports.format = format;
exports.from = from;
exports.fromAbi = fromAbi;
exports.getSelector = getSelector;
exports.getSignature = getSignature;
exports.getSignatureHash = getSignatureHash;
const abitype = require("abitype");
const Errors = require("./Errors.js");
const Hash = require("./Hash.js");
const Hex = require("./Hex.js");
const internal = require("./internal/abiItem.js");
function format(abiItem) {
return abitype.formatAbiItem(abiItem);
}
function from(abiItem, options = {}) {
const { prepare = true } = options;
const item = (() => {
if (Array.isArray(abiItem))
return abitype.parseAbiItem(abiItem);
if (typeof abiItem === 'string')
return abitype.parseAbiItem(abiItem);
return abiItem;
})();
return {
...item,
...(prepare ? { hash: getSignatureHash(item) } : {}),
};
}
function fromAbi(abi, name, options) {
const { args = [], prepare = true } = (options ??
{});
const isSelector = Hex.validate(name, { strict: false });
const abiItems = abi.filter((abiItem) => {
if (isSelector) {
if (abiItem.type === 'function' || abiItem.type === 'error')
return getSelector(abiItem) === Hex.slice(name, 0, 4);
if (abiItem.type === 'event')
return getSignatureHash(abiItem) === name;
return false;
}
return 'name' in abiItem && abiItem.name === name;
});
if (abiItems.length === 0)
throw new NotFoundError({ name: name });
if (abiItems.length === 1)
return {
...abiItems[0],
...(prepare ? { hash: getSignatureHash(abiItems[0]) } : {}),
};
let matchedAbiItem = undefined;
for (const abiItem of abiItems) {
if (!('inputs' in abiItem))
continue;
if (!args || args.length === 0) {
if (!abiItem.inputs || abiItem.inputs.length === 0)
return {
...abiItem,
...(prepare ? { hash: getSignatureHash(abiItem) } : {}),
};
continue;
}
if (!abiItem.inputs)
continue;
if (abiItem.inputs.length === 0)
continue;
if (abiItem.inputs.length !== args.length)
continue;
const matched = args.every((arg, index) => {
const abiParameter = 'inputs' in abiItem && abiItem.inputs[index];
if (!abiParameter)
return false;
return internal.isArgOfType(arg, abiParameter);
});
if (matched) {
if (matchedAbiItem &&
'inputs' in matchedAbiItem &&
matchedAbiItem.inputs) {
const ambiguousTypes = internal.getAmbiguousTypes(abiItem.inputs, matchedAbiItem.inputs, args);
if (ambiguousTypes)
throw new AmbiguityError({
abiItem,
type: ambiguousTypes[0],
}, {
abiItem: matchedAbiItem,
type: ambiguousTypes[1],
});
}
matchedAbiItem = abiItem;
}
}
const abiItem = (() => {
if (matchedAbiItem)
return matchedAbiItem;
const [abiItem, ...overloads] = abiItems;
return { ...abiItem, overloads };
})();
if (!abiItem)
throw new NotFoundError({ name: name });
return {
...abiItem,
...(prepare ? { hash: getSignatureHash(abiItem) } : {}),
};
}
function getSelector(abiItem) {
return Hex.slice(getSignatureHash(abiItem), 0, 4);
}
function getSignature(abiItem) {
const signature = (() => {
if (typeof abiItem === 'string')
return abiItem;
return abitype.formatAbiItem(abiItem);
})();
return internal.normalizeSignature(signature);
}
function getSignatureHash(abiItem) {
if (typeof abiItem !== 'string' && 'hash' in abiItem && abiItem.hash)
return abiItem.hash;
return Hash.keccak256(Hex.fromString(getSignature(abiItem)));
}
class AmbiguityError extends Errors.BaseError {
constructor(x, y) {
super('Found ambiguous types in overloaded ABI Items.', {
metaMessages: [
`\`${x.type}\` in \`${internal.normalizeSignature(abitype.formatAbiItem(x.abiItem))}\`, and`,
`\`${y.type}\` in \`${internal.normalizeSignature(abitype.formatAbiItem(y.abiItem))}\``,
'',
'These types encode differently and cannot be distinguished at runtime.',
'Remove one of the ambiguous items in the ABI.',
],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiItem.AmbiguityError'
});
}
}
exports.AmbiguityError = AmbiguityError;
class NotFoundError extends Errors.BaseError {
constructor({ name, data, type = 'item', }) {
const selector = (() => {
if (name)
return ` with name "${name}"`;
if (data)
return ` with data "${data}"`;
return '';
})();
super(`ABI ${type}${selector} not found.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiItem.NotFoundError'
});
}
}
exports.NotFoundError = NotFoundError;
class InvalidSelectorSizeError extends Errors.BaseError {
constructor({ data }) {
super(`Selector size is invalid. Expected 4 bytes. Received ${Hex.size(data)} bytes ("${data}").`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiItem.InvalidSelectorSizeError'
});
}
}
exports.InvalidSelectorSizeError = InvalidSelectorSizeError;
//# sourceMappingURL=AbiItem.js.map

1
node_modules/ox/_cjs/core/AbiItem.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

227
node_modules/ox/_cjs/core/AbiParameters.js generated vendored Normal file
View File

@@ -0,0 +1,227 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidTypeError = exports.InvalidArrayError = exports.LengthMismatchError = exports.BytesSizeMismatchError = exports.ArrayLengthMismatchError = exports.ZeroDataError = exports.DataSizeTooSmallError = void 0;
exports.decode = decode;
exports.encode = encode;
exports.encodePacked = encodePacked;
exports.format = format;
exports.from = from;
const abitype = require("abitype");
const Address = require("./Address.js");
const Bytes = require("./Bytes.js");
const Errors = require("./Errors.js");
const Hex = require("./Hex.js");
const Solidity = require("./Solidity.js");
const internal = require("./internal/abiParameters.js");
const Cursor = require("./internal/cursor.js");
function decode(parameters, data, options = {}) {
const { as = 'Array', checksumAddress = false } = options;
const bytes = typeof data === 'string' ? Bytes.fromHex(data) : data;
const cursor = Cursor.create(bytes);
if (Bytes.size(bytes) === 0 && parameters.length > 0)
throw new ZeroDataError();
if (Bytes.size(bytes) && Bytes.size(bytes) < 32)
throw new DataSizeTooSmallError({
data: typeof data === 'string' ? data : Hex.fromBytes(data),
parameters: parameters,
size: Bytes.size(bytes),
});
let consumed = 0;
const values = as === 'Array' ? [] : {};
for (let i = 0; i < parameters.length; ++i) {
const param = parameters[i];
cursor.setPosition(consumed);
const [data, consumed_] = internal.decodeParameter(cursor, param, {
checksumAddress,
staticPosition: 0,
});
consumed += consumed_;
if (as === 'Array')
values.push(data);
else
values[param.name ?? i] = data;
}
return values;
}
function encode(parameters, values, options) {
const { checksumAddress = false } = options ?? {};
if (parameters.length !== values.length)
throw new LengthMismatchError({
expectedLength: parameters.length,
givenLength: values.length,
});
const preparedParameters = internal.prepareParameters({
checksumAddress,
parameters: parameters,
values: values,
});
const data = internal.encode(preparedParameters);
if (data.length === 0)
return '0x';
return data;
}
function encodePacked(types, values) {
if (types.length !== values.length)
throw new LengthMismatchError({
expectedLength: types.length,
givenLength: values.length,
});
const data = [];
for (let i = 0; i < types.length; i++) {
const type = types[i];
const value = values[i];
data.push(encodePacked.encode(type, value));
}
return Hex.concat(...data);
}
(function (encodePacked) {
function encode(type, value, isArray = false) {
if (type === 'address') {
const address = value;
Address.assert(address);
return Hex.padLeft(address.toLowerCase(), isArray ? 32 : 0);
}
if (type === 'string')
return Hex.fromString(value);
if (type === 'bytes')
return value;
if (type === 'bool')
return Hex.padLeft(Hex.fromBoolean(value), isArray ? 32 : 1);
const intMatch = type.match(Solidity.integerRegex);
if (intMatch) {
const [_type, baseType, bits = '256'] = intMatch;
const size = Number.parseInt(bits) / 8;
return Hex.fromNumber(value, {
size: isArray ? 32 : size,
signed: baseType === 'int',
});
}
const bytesMatch = type.match(Solidity.bytesRegex);
if (bytesMatch) {
const [_type, size] = bytesMatch;
if (Number.parseInt(size) !== (value.length - 2) / 2)
throw new BytesSizeMismatchError({
expectedSize: Number.parseInt(size),
value: value,
});
return Hex.padRight(value, isArray ? 32 : 0);
}
const arrayMatch = type.match(Solidity.arrayRegex);
if (arrayMatch && Array.isArray(value)) {
const [_type, childType] = arrayMatch;
const data = [];
for (let i = 0; i < value.length; i++) {
data.push(encode(childType, value[i], true));
}
if (data.length === 0)
return '0x';
return Hex.concat(...data);
}
throw new InvalidTypeError(type);
}
encodePacked.encode = encode;
})(encodePacked || (exports.encodePacked = encodePacked = {}));
function format(parameters) {
return abitype.formatAbiParameters(parameters);
}
function from(parameters) {
if (Array.isArray(parameters) && typeof parameters[0] === 'string')
return abitype.parseAbiParameters(parameters);
if (typeof parameters === 'string')
return abitype.parseAbiParameters(parameters);
return parameters;
}
class DataSizeTooSmallError extends Errors.BaseError {
constructor({ data, parameters, size, }) {
super(`Data size of ${size} bytes is too small for given parameters.`, {
metaMessages: [
`Params: (${abitype.formatAbiParameters(parameters)})`,
`Data: ${data} (${size} bytes)`,
],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.DataSizeTooSmallError'
});
}
}
exports.DataSizeTooSmallError = DataSizeTooSmallError;
class ZeroDataError extends Errors.BaseError {
constructor() {
super('Cannot decode zero data ("0x") with ABI parameters.');
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.ZeroDataError'
});
}
}
exports.ZeroDataError = ZeroDataError;
class ArrayLengthMismatchError extends Errors.BaseError {
constructor({ expectedLength, givenLength, type, }) {
super(`Array length mismatch for type \`${type}\`. Expected: \`${expectedLength}\`. Given: \`${givenLength}\`.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.ArrayLengthMismatchError'
});
}
}
exports.ArrayLengthMismatchError = ArrayLengthMismatchError;
class BytesSizeMismatchError extends Errors.BaseError {
constructor({ expectedSize, value, }) {
super(`Size of bytes "${value}" (bytes${Hex.size(value)}) does not match expected size (bytes${expectedSize}).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.BytesSizeMismatchError'
});
}
}
exports.BytesSizeMismatchError = BytesSizeMismatchError;
class LengthMismatchError extends Errors.BaseError {
constructor({ expectedLength, givenLength, }) {
super([
'ABI encoding parameters/values length mismatch.',
`Expected length (parameters): ${expectedLength}`,
`Given length (values): ${givenLength}`,
].join('\n'));
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.LengthMismatchError'
});
}
}
exports.LengthMismatchError = LengthMismatchError;
class InvalidArrayError extends Errors.BaseError {
constructor(value) {
super(`Value \`${value}\` is not a valid array.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.InvalidArrayError'
});
}
}
exports.InvalidArrayError = InvalidArrayError;
class InvalidTypeError extends Errors.BaseError {
constructor(type) {
super(`Type \`${type}\` is not a valid ABI Type.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AbiParameters.InvalidTypeError'
});
}
}
exports.InvalidTypeError = InvalidTypeError;
//# sourceMappingURL=AbiParameters.js.map

1
node_modules/ox/_cjs/core/AbiParameters.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

51
node_modules/ox/_cjs/core/AccessList.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidStorageKeySizeError = void 0;
exports.fromTupleList = fromTupleList;
exports.toTupleList = toTupleList;
const Address = require("./Address.js");
const Errors = require("./Errors.js");
const Hash = require("./Hash.js");
const Hex = require("./Hex.js");
function fromTupleList(accessList) {
const list = [];
for (let i = 0; i < accessList.length; i++) {
const [address, storageKeys] = accessList[i];
if (address)
Address.assert(address, { strict: false });
list.push({
address: address,
storageKeys: storageKeys.map((key) => Hash.validate(key) ? key : Hex.trimLeft(key)),
});
}
return list;
}
function toTupleList(accessList) {
if (!accessList || accessList.length === 0)
return [];
const tuple = [];
for (const { address, storageKeys } of accessList) {
for (let j = 0; j < storageKeys.length; j++)
if (Hex.size(storageKeys[j]) !== 32)
throw new InvalidStorageKeySizeError({
storageKey: storageKeys[j],
});
if (address)
Address.assert(address, { strict: false });
tuple.push([address, storageKeys]);
}
return tuple;
}
class InvalidStorageKeySizeError extends Errors.BaseError {
constructor({ storageKey }) {
super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Hex.size(storageKey)} bytes.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'AccessList.InvalidStorageKeySizeError'
});
}
}
exports.InvalidStorageKeySizeError = InvalidStorageKeySizeError;
//# sourceMappingURL=AccessList.js.map

1
node_modules/ox/_cjs/core/AccessList.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AccessList.js","sourceRoot":"","sources":["../../core/AccessList.ts"],"names":[],"mappings":";;;AAiDA,sCAeC;AA+BD,kCAkBC;AAjHD,wCAAuC;AACvC,sCAAqC;AACrC,kCAAiC;AACjC,gCAA+B;AA8C/B,SAAgB,aAAa,CAAC,UAAiB;IAC7C,MAAM,IAAI,GAAwB,EAAE,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,CAAC,CAAyB,CAAA;QAEpE,IAAI,OAAO;YAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;QAEvD,IAAI,CAAC,IAAI,CAAC;YACR,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAC7C;SACF,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AA+BD,SAAgB,WAAW,CACzB,UAAmC;IAEnC,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAErD,MAAM,KAAK,GAAmB,EAAE,CAAA;IAChC,KAAK,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE;YACzC,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC,KAAK,EAAE;gBAClC,MAAM,IAAI,0BAA0B,CAAC;oBACnC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAE;iBAC5B,CAAC,CAAA;QAEN,IAAI,OAAO;YAAE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;QAEvD,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;IACpC,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAGD,MAAa,0BAA2B,SAAQ,MAAM,CAAC,SAAS;IAE9D,YAAY,EAAE,UAAU,EAA2B;QACjD,KAAK,CACH,yBAAyB,UAAU,wCAAwC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CACzG,CAAA;QAJe;;;;mBAAO,uCAAuC;WAAA;IAKhE,CAAC;CACF;AAPD,gEAOC"}

3
node_modules/ox/_cjs/core/AccountProof.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=AccountProof.js.map

1
node_modules/ox/_cjs/core/AccountProof.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AccountProof.js","sourceRoot":"","sources":["../../core/AccountProof.ts"],"names":[],"mappings":""}

116
node_modules/ox/_cjs/core/Address.js generated vendored Normal file
View File

@@ -0,0 +1,116 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidChecksumError = exports.InvalidInputError = exports.InvalidAddressError = void 0;
exports.assert = assert;
exports.checksum = checksum;
exports.from = from;
exports.fromPublicKey = fromPublicKey;
exports.isEqual = isEqual;
exports.validate = validate;
const Bytes = require("./Bytes.js");
const Caches = require("./Caches.js");
const Errors = require("./Errors.js");
const Hash = require("./Hash.js");
const PublicKey = require("./PublicKey.js");
const addressRegex = /^0x[a-fA-F0-9]{40}$/;
function assert(value, options = {}) {
const { strict = true } = options;
if (!addressRegex.test(value))
throw new InvalidAddressError({
address: value,
cause: new InvalidInputError(),
});
if (strict) {
if (value.toLowerCase() === value)
return;
if (checksum(value) !== value)
throw new InvalidAddressError({
address: value,
cause: new InvalidChecksumError(),
});
}
}
function checksum(address) {
if (Caches.checksum.has(address))
return Caches.checksum.get(address);
assert(address, { strict: false });
const hexAddress = address.substring(2).toLowerCase();
const hash = Hash.keccak256(Bytes.fromString(hexAddress), { as: 'Bytes' });
const characters = hexAddress.split('');
for (let i = 0; i < 40; i += 2) {
if (hash[i >> 1] >> 4 >= 8 && characters[i]) {
characters[i] = characters[i].toUpperCase();
}
if ((hash[i >> 1] & 0x0f) >= 8 && characters[i + 1]) {
characters[i + 1] = characters[i + 1].toUpperCase();
}
}
const result = `0x${characters.join('')}`;
Caches.checksum.set(address, result);
return result;
}
function from(address, options = {}) {
const { checksum: checksumVal = false } = options;
assert(address);
if (checksumVal)
return checksum(address);
return address;
}
function fromPublicKey(publicKey, options = {}) {
const address = Hash.keccak256(`0x${PublicKey.toHex(publicKey).slice(4)}`).substring(26);
return from(`0x${address}`, options);
}
function isEqual(addressA, addressB) {
assert(addressA, { strict: false });
assert(addressB, { strict: false });
return addressA.toLowerCase() === addressB.toLowerCase();
}
function validate(address, options = {}) {
const { strict = true } = options ?? {};
try {
assert(address, { strict });
return true;
}
catch {
return false;
}
}
class InvalidAddressError extends Errors.BaseError {
constructor({ address, cause }) {
super(`Address "${address}" is invalid.`, {
cause,
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Address.InvalidAddressError'
});
}
}
exports.InvalidAddressError = InvalidAddressError;
class InvalidInputError extends Errors.BaseError {
constructor() {
super('Address is not a 20 byte (40 hexadecimal character) value.');
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Address.InvalidInputError'
});
}
}
exports.InvalidInputError = InvalidInputError;
class InvalidChecksumError extends Errors.BaseError {
constructor() {
super('Address does not match its checksum counterpart.');
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Address.InvalidChecksumError'
});
}
}
exports.InvalidChecksumError = InvalidChecksumError;
//# sourceMappingURL=Address.js.map

1
node_modules/ox/_cjs/core/Address.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Address.js","sourceRoot":"","sources":["../../core/Address.ts"],"names":[],"mappings":";;;AAiCA,wBAoBC;AA6BD,4BAqBC;AA2CD,oBAKC;AAoCD,sCAQC;AA+CD,0BAIC;AA6BD,4BAWC;AA7RD,oCAAmC;AACnC,sCAAqC;AACrC,sCAAqC;AACrC,kCAAiC;AACjC,4CAA2C;AAE3C,MAAM,YAAY,GAAiB,qBAAqB,CAAA;AA0BxD,SAAgB,MAAM,CACpB,KAAa,EACb,UAA0B,EAAE;IAE5B,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAEjC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAC3B,MAAM,IAAI,mBAAmB,CAAC;YAC5B,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI,iBAAiB,EAAE;SAC/B,CAAC,CAAA;IAEJ,IAAI,MA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,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;IACvC,IAAI,CAAC;QACH,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAwBD,MAAa,mBAIX,SAAQ,MAAM,CAAC,SAAgB;IAG/B,YAAY,EAAE,OAAO,EAAE,KAAK,EAAqC;QAC/D,KAAK,CAAC,YAAY,OAAO,eAAe,EAAE;YACxC,KAAK;SACN,CAAC,CAAA;QALc;;;;mBAAO,6BAA6B;WAAA;IAMtD,CAAC;CACF;AAZD,kDAYC;AAGD,MAAa,iBAAkB,SAAQ,MAAM,CAAC,SAAS;IAGrD;QACE,KAAK,CAAC,4DAA4D,CAAC,CAAA;QAHnD;;;;mBAAO,2BAA2B;WAAA;IAIpD,CAAC;CACF;AAND,8CAMC;AAGD,MAAa,oBAAqB,SAAQ,MAAM,CAAC,SAAS;IAGxD;QACE,KAAK,CAAC,kDAAkD,CAAC,CAAA;QAHzC;;;;mBAAO,8BAA8B;WAAA;IAIvD,CAAC;CACF;AAND,oDAMC"}

51
node_modules/ox/_cjs/core/AesGcm.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ivLength = void 0;
exports.decrypt = decrypt;
exports.encrypt = encrypt;
exports.getKey = getKey;
exports.randomSalt = randomSalt;
const Bytes = require("./Bytes.js");
const Hex = require("./Hex.js");
exports.ivLength = 16;
async function decrypt(value, key, options = {}) {
const { as = typeof value === 'string' ? 'Hex' : 'Bytes' } = options;
const encrypted = Bytes.from(value);
const iv = encrypted.slice(0, exports.ivLength);
const data = encrypted.slice(exports.ivLength);
const decrypted = await globalThis.crypto.subtle.decrypt({
name: 'AES-GCM',
iv,
}, key, Bytes.from(data));
const result = new Uint8Array(decrypted);
if (as === 'Bytes')
return result;
return Hex.from(result);
}
async function encrypt(value, key, options = {}) {
const { as = typeof value === 'string' ? 'Hex' : 'Bytes' } = options;
const iv = Bytes.random(exports.ivLength);
const encrypted = await globalThis.crypto.subtle.encrypt({
name: 'AES-GCM',
iv,
}, key, Bytes.from(value));
const result = Bytes.concat(iv, new Uint8Array(encrypted));
if (as === 'Bytes')
return result;
return Hex.from(result);
}
async function getKey(options) {
const { iterations = 900_000, password, salt = randomSalt(32) } = options;
const baseKey = await globalThis.crypto.subtle.importKey('raw', Bytes.fromString(password), { name: 'PBKDF2' }, false, ['deriveBits', 'deriveKey']);
const key = await globalThis.crypto.subtle.deriveKey({
name: 'PBKDF2',
salt,
iterations,
hash: 'SHA-256',
}, baseKey, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
return key;
}
function randomSalt(size = 32) {
return Bytes.random(size);
}
//# sourceMappingURL=AesGcm.js.map

1
node_modules/ox/_cjs/core/AesGcm.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"AesGcm.js","sourceRoot":"","sources":["../../core/AesGcm.ts"],"names":[],"mappings":";;;AA2BA,0BAyBC;AAqCD,0BAuBC;AAkCD,wBAsBC;AA6BD,gCAEC;AAvMD,oCAAmC;AAEnC,gCAA+B;AAElB,QAAA,QAAQ,GAAG,EAAE,CAAA;AAuBnB,KAAK,UAAU,OAAO,CAM3B,KAAoC,EACpC,GAAc,EACd,UAA+B,EAAE;IAEjC,MAAM,EAAE,EAAE,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,OAAO,CAAA;IACpE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACnC,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAQ,CAAC,CAAA;IACvC,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAQ,C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,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CACtD,KAAK,EACL,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAC1B,EAAE,IAAI,EAAE,QAAQ,EAAE,EAClB,KAAK,EACL,CAAC,YAAY,EAAE,WAAW,CAAC,CAC5B,CAAA;IACD,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAClD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI;QACJ,UAAU;QACV,IAAI,EAAE,SAAS;KAChB,EACD,OAAO,EACP,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,EAChC,KAAK,EACL,CAAC,SAAS,EAAE,SAAS,CAAC,CACvB,CAAA;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AA6BD,SAAgB,UAAU,CAAC,IAAI,GAAG,EAAE;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC"}

88
node_modules/ox/_cjs/core/Authorization.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.from = from;
exports.fromRpc = fromRpc;
exports.fromRpcList = fromRpcList;
exports.fromTuple = fromTuple;
exports.fromTupleList = fromTupleList;
exports.getSignPayload = getSignPayload;
exports.hash = hash;
exports.toRpc = toRpc;
exports.toRpcList = toRpcList;
exports.toTuple = toTuple;
exports.toTupleList = toTupleList;
const Hash = require("./Hash.js");
const Hex = require("./Hex.js");
const Rlp = require("./Rlp.js");
const Signature = require("./Signature.js");
function from(authorization, options = {}) {
if (typeof authorization.chainId === 'string')
return fromRpc(authorization);
return { ...authorization, ...options.signature };
}
function fromRpc(authorization) {
const { address, chainId, nonce } = authorization;
const signature = Signature.extract(authorization);
return {
address,
chainId: Number(chainId),
nonce: BigInt(nonce),
...signature,
};
}
function fromRpcList(authorizationList) {
return authorizationList.map(fromRpc);
}
function fromTuple(tuple) {
const [chainId, address, nonce, yParity, r, s] = tuple;
const signature = yParity && r && s ? Signature.fromTuple([yParity, r, s]) : undefined;
return from({
address,
chainId: Number(chainId),
nonce: BigInt(nonce),
...signature,
});
}
function fromTupleList(tupleList) {
const list = [];
for (const tuple of tupleList)
list.push(fromTuple(tuple));
return list;
}
function getSignPayload(authorization) {
return hash(authorization);
}
function hash(authorization) {
return Hash.keccak256(Hex.concat('0x05', Rlp.fromHex(toTuple(authorization))));
}
function toRpc(authorization) {
const { address, chainId, nonce, ...signature } = authorization;
return {
address,
chainId: Hex.fromNumber(chainId),
nonce: Hex.fromNumber(nonce),
...Signature.toRpc(signature),
};
}
function toRpcList(authorizationList) {
return authorizationList.map(toRpc);
}
function toTuple(authorization) {
const { address, chainId, nonce } = authorization;
const signature = Signature.extract(authorization);
return [
chainId ? Hex.fromNumber(chainId) : '0x',
address,
nonce ? Hex.fromNumber(nonce) : '0x',
...(signature ? Signature.toTuple(signature) : []),
];
}
function toTupleList(list) {
if (!list || list.length === 0)
return [];
const tupleList = [];
for (const authorization of list)
tupleList.push(toTuple(authorization));
return tupleList;
}
//# sourceMappingURL=Authorization.js.map

1
node_modules/ox/_cjs/core/Authorization.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Authorization.js","sourceRoot":"","sources":["../../core/Authorization.ts"],"names":[],"mappings":";;AAsHA,oBAUC;AA+CD,0BAUC;AA0BD,kCAEC;AAoDD,8BAYC;AAoED,sCAMC;AAqCD,wCAEC;AAyBD,oBAEC;AA+BD,sBASC;AA0BD,8BAEC;AA8BD,0BAWC;AA6CD,kCAWC;AApkBD,kCAAiC;AACjC,gCAA+B;AAC/B,gCAA+B;AAC/B,4CAA2C;AAiH3C,SAAgB,IAAI,CAIlB,aAA4C,EAC5C,UAAmC,EAAE;IAErC,IAAI,OAAO,aAAa,CAAC,OAAO,KAAK,QAAQ;QAC3C,OAAO,OAAO,CAAC,aAAa,CAAU,CAAA;IACxC,OAAO,EAAE,GAAG,aAAa,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AC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAEzC,MAAM,SAAS,GAAuB,EAAE,CAAA;IACxC,KAAK,MAAM,aAAa,IAAI,IAAI;QAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;IAExE,OAAO,SAAkB,CAAA;AAC3B,CAAC"}

46
node_modules/ox/_cjs/core/Base58.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromBytes = fromBytes;
exports.fromHex = fromHex;
exports.fromString = fromString;
exports.toBytes = toBytes;
exports.toHex = toHex;
exports.toString = toString;
const Bytes = require("./Bytes.js");
const Hex = require("./Hex.js");
const internal = require("./internal/base58.js");
function fromBytes(value) {
return internal.from(value);
}
function fromHex(value) {
return internal.from(value);
}
function fromString(value) {
return internal.from(Bytes.fromString(value));
}
function toBytes(value) {
return Bytes.fromHex(toHex(value));
}
function toHex(value) {
let integer = BigInt(0);
let pad = 0;
let checkPad = true;
for (let i = 0; i < value.length; i++) {
const char = value[i];
if (checkPad && char === '1')
pad++;
else
checkPad = false;
if (typeof internal.alphabetToInteger[char] !== 'bigint')
throw new Error('invalid base58 character: ' + char);
integer = integer * 58n;
integer = integer + internal.alphabetToInteger[char];
}
if (!pad)
return `0x${integer.toString(16)}`;
return `0x${'0'.repeat(pad * 2)}${integer.toString(16)}`;
}
function toString(value) {
return Hex.toString(toHex(value));
}
//# sourceMappingURL=Base58.js.map

1
node_modules/ox/_cjs/core/Base58.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Base58.js","sourceRoot":"","sources":["../../core/Base58.ts"],"names":[],"mappings":";;AAmBA,8BAEC;AAoBD,0BAEC;AAoBD,gCAEC;AAoBD,0BAEC;AAoBD,sBAsBC;AAoBD,4BAEC;AAvJD,oCAAmC;AAEnC,gCAA+B;AAC/B,iDAAgD;AAgBhD,SAAgB,SAAS,CAAC,KAAkB;IAC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GAAG,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAa,CAAA;AACrE,CAAC;AAoBD,SAAgB,QAAQ,CAAC,KAAa;IACpC,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;AACnC,CAAC"}

70
node_modules/ox/_cjs/core/Base64.js generated vendored Normal file
View File

@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromBytes = fromBytes;
exports.fromHex = fromHex;
exports.fromString = fromString;
exports.toBytes = toBytes;
exports.toHex = toHex;
exports.toString = toString;
const Bytes = require("./Bytes.js");
const Hex = require("./Hex.js");
const encoder = new TextEncoder();
const decoder = new TextDecoder();
const integerToCharacter = Object.fromEntries(Array.from('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/').map((a, i) => [i, a.charCodeAt(0)]));
const characterToInteger = {
...Object.fromEntries(Array.from('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/').map((a, i) => [a.charCodeAt(0), i])),
['='.charCodeAt(0)]: 0,
['-'.charCodeAt(0)]: 62,
['_'.charCodeAt(0)]: 63,
};
function fromBytes(value, options = {}) {
const { pad = true, url = false } = options;
const encoded = new Uint8Array(Math.ceil(value.length / 3) * 4);
for (let i = 0, j = 0; j < value.length; i += 4, j += 3) {
const y = (value[j] << 16) + (value[j + 1] << 8) + (value[j + 2] | 0);
encoded[i] = integerToCharacter[y >> 18];
encoded[i + 1] = integerToCharacter[(y >> 12) & 0x3f];
encoded[i + 2] = integerToCharacter[(y >> 6) & 0x3f];
encoded[i + 3] = integerToCharacter[y & 0x3f];
}
const k = value.length % 3;
const end = Math.floor(value.length / 3) * 4 + (k && k + 1);
let base64 = decoder.decode(new Uint8Array(encoded.buffer, 0, end));
if (pad && k === 1)
base64 += '==';
if (pad && k === 2)
base64 += '=';
if (url)
base64 = base64.replaceAll('+', '-').replaceAll('/', '_');
return base64;
}
function fromHex(value, options = {}) {
return fromBytes(Bytes.fromHex(value), options);
}
function fromString(value, options = {}) {
return fromBytes(Bytes.fromString(value), options);
}
function toBytes(value) {
const base64 = value.replace(/=+$/, '');
const size = base64.length;
const decoded = new Uint8Array(size + 3);
encoder.encodeInto(base64 + '===', decoded);
for (let i = 0, j = 0; i < base64.length; i += 4, j += 3) {
const x = (characterToInteger[decoded[i]] << 18) +
(characterToInteger[decoded[i + 1]] << 12) +
(characterToInteger[decoded[i + 2]] << 6) +
characterToInteger[decoded[i + 3]];
decoded[j] = x >> 16;
decoded[j + 1] = (x >> 8) & 0xff;
decoded[j + 2] = x & 0xff;
}
const decodedSize = (size >> 2) * 3 + (size % 4 && (size % 4) - 1);
return new Uint8Array(decoded.buffer, 0, decodedSize);
}
function toHex(value) {
return Hex.fromBytes(toBytes(value));
}
function toString(value) {
return Bytes.toString(toBytes(value));
}
//# sourceMappingURL=Base64.js.map

1
node_modules/ox/_cjs/core/Base64.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Base64.js","sourceRoot":"","sources":["../../core/Base64.ts"],"names":[],"mappings":";;AA8DA,8BAoBC;AA2DD,0BAEC;AA2DD,gCAEC;AAmCD,0BAqBC;AAoBD,sBAEC;AAoBD,4BAEC;AAhTD,oCAAmC;AAEnC,gCAA+B;AAE/B,MAAM,OAAO,GAAiB,IAAI,WAAW,EAAE,CAAA;AAC/C,MAAM,OAAO,GAAiB,IAAI,WAAW,EAAE,CAAA;AAE/C,MAAM,kBAAkB,GAAiB,MAAM,CAAC,WAAW,CACzD,KAAK,CAAC,IAAI,CACR,kEAAkE,CACnE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CACtC,CAAA;AAED,MAAM,kBAAkB,GAAiB;IACvC,GAAG,MAA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,SAAgB,KAAK,CAAC,KAAa;IACjC,OAAO,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;AACtC,CAAC;AAoBD,SAAgB,QAAQ,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;AACvC,CAAC"}

141
node_modules/ox/_cjs/core/BinaryStateTree.js generated vendored Normal file
View File

@@ -0,0 +1,141 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = create;
exports.insert = insert;
exports.merkelize = merkelize;
const blake3_1 = require("@noble/hashes/blake3");
const Bytes = require("./Bytes.js");
function create() {
return {
root: emptyNode(),
};
}
function insert(tree, key, value) {
const stem = Bytes.slice(key, 0, 31);
const subIndex = Bytes.slice(key, 31)[0];
if (tree.root.type === 'empty') {
tree.root = stemNode(stem);
tree.root.values[subIndex] = value;
return;
}
function inner(node_, stem, subIndex, value, depth) {
let node = node_;
if (node.type === 'empty') {
node = stemNode(stem);
node.values[subIndex] = value;
return node;
}
const stemBits = bytesToBits(stem);
if (node.type === 'stem') {
if (Bytes.isEqual(node.stem, stem)) {
node.values[subIndex] = value;
return node;
}
const existingStemBits = bytesToBits(node.stem);
return splitLeaf(node, stemBits, existingStemBits, subIndex, value, depth);
}
if (node.type === 'internal') {
const bit = stemBits[depth];
if (bit === 0) {
node.left = inner(node.left, stem, subIndex, value, depth + 1);
}
else {
node.right = inner(node.right, stem, subIndex, value, depth + 1);
}
return node;
}
return emptyNode();
}
tree.root = inner(tree.root, stem, subIndex, value, 0);
}
function merkelize(tree) {
function inner(node) {
if (node.type === 'empty')
return new Uint8Array(32).fill(0);
if (node.type === 'internal') {
const hash_left = inner(node.left);
const hash_right = inner(node.right);
return hash(Bytes.concat(hash_left, hash_right));
}
let level = node.values.map(hash);
while (level.length > 1) {
const level_ = [];
for (let i = 0; i < level.length; i += 2)
level_.push(hash(Bytes.concat(level[i], level[i + 1])));
level = level_;
}
return hash(Bytes.concat(node.stem, new Uint8Array(1).fill(0), level[0]));
}
return inner(tree.root);
}
function splitLeaf(leaf, stemBits, existingStemBits, subIndex, value, depth) {
if (stemBits[depth] === existingStemBits[depth]) {
const internal = internalNode();
const bit = stemBits[depth];
if (bit === 0) {
internal.left = splitLeaf(leaf, stemBits, existingStemBits, subIndex, value, depth + 1);
}
else {
internal.right = splitLeaf(leaf, stemBits, existingStemBits, subIndex, value, depth + 1);
}
return internal;
}
const internal = internalNode();
const bit = stemBits[depth];
const stem = bitsToBytes(stemBits);
if (bit === 0) {
internal.left = stemNode(stem);
internal.left.values[subIndex] = value;
internal.right = leaf;
}
else {
internal.right = stemNode(stem);
internal.right.values[subIndex] = value;
internal.left = leaf;
}
return internal;
}
function emptyNode() {
return {
type: 'empty',
};
}
function internalNode() {
return {
left: emptyNode(),
right: emptyNode(),
type: 'internal',
};
}
function stemNode(stem) {
return {
stem,
values: Array.from({ length: 256 }, () => undefined),
type: 'stem',
};
}
function bytesToBits(bytes) {
const bits = [];
for (const byte of bytes)
for (let i = 0; i < 8; i++)
bits.push((byte >> (7 - i)) & 1);
return bits;
}
function bitsToBytes(bits) {
const byte_data = new Uint8Array(bits.length / 8);
for (let i = 0; i < bits.length; i += 8) {
let byte = 0;
for (let j = 0; j < 8; j++)
byte |= bits[i + j] << (7 - j);
byte_data[i / 8] = byte;
}
return byte_data;
}
function hash(bytes) {
if (!bytes)
return new Uint8Array(32).fill(0);
if (!bytes.some((byte) => byte !== 0))
return new Uint8Array(32).fill(0);
return (0, blake3_1.blake3)(bytes);
}
//# sourceMappingURL=BinaryStateTree.js.map

1
node_modules/ox/_cjs/core/BinaryStateTree.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

244
node_modules/ox/_cjs/core/Blobs.js generated vendored Normal file
View File

@@ -0,0 +1,244 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidVersionedHashVersionError = exports.InvalidVersionedHashSizeError = exports.EmptyBlobVersionedHashesError = exports.EmptyBlobError = exports.BlobSizeTooLargeError = exports.maxBytesPerTransaction = exports.bytesPerBlob = exports.fieldElementsPerBlob = exports.bytesPerFieldElement = void 0;
exports.commitmentsToVersionedHashes = commitmentsToVersionedHashes;
exports.commitmentToVersionedHash = commitmentToVersionedHash;
exports.from = from;
exports.sidecarsToVersionedHashes = sidecarsToVersionedHashes;
exports.to = to;
exports.toHex = toHex;
exports.toBytes = toBytes;
exports.toCommitments = toCommitments;
exports.toProofs = toProofs;
exports.toSidecars = toSidecars;
exports.toVersionedHashes = toVersionedHashes;
const Bytes = require("./Bytes.js");
const Errors = require("./Errors.js");
const Hash = require("./Hash.js");
const Hex = require("./Hex.js");
const Kzg = require("./Kzg.js");
const Cursor = require("./internal/cursor.js");
const blobsPerTransaction = 6;
exports.bytesPerFieldElement = 32;
exports.fieldElementsPerBlob = 4096;
exports.bytesPerBlob = exports.bytesPerFieldElement * exports.fieldElementsPerBlob;
exports.maxBytesPerTransaction = exports.bytesPerBlob * blobsPerTransaction -
1 -
1 * exports.fieldElementsPerBlob * blobsPerTransaction;
function commitmentsToVersionedHashes(commitments, options = {}) {
const { version } = options;
const as = options.as ?? (typeof commitments[0] === 'string' ? 'Hex' : 'Bytes');
const hashes = [];
for (const commitment of commitments) {
hashes.push(commitmentToVersionedHash(commitment, {
as,
version,
}));
}
return hashes;
}
function commitmentToVersionedHash(commitment, options = {}) {
const { version = 1 } = options;
const as = options.as ?? (typeof commitment === 'string' ? 'Hex' : 'Bytes');
const versionedHash = Hash.sha256(commitment, { as: 'Bytes' });
versionedHash.set([version], 0);
return (as === 'Bytes' ? versionedHash : Hex.fromBytes(versionedHash));
}
function from(data, options = {}) {
const as = options.as ?? (typeof data === 'string' ? 'Hex' : 'Bytes');
const data_ = (typeof data === 'string' ? Bytes.fromHex(data) : data);
const size_ = Bytes.size(data_);
if (!size_)
throw new EmptyBlobError();
if (size_ > exports.maxBytesPerTransaction)
throw new BlobSizeTooLargeError({
maxSize: exports.maxBytesPerTransaction,
size: size_,
});
const blobs = [];
let active = true;
let position = 0;
while (active) {
const blob = Cursor.create(new Uint8Array(exports.bytesPerBlob));
let size = 0;
while (size < exports.fieldElementsPerBlob) {
const bytes = data_.slice(position, position + (exports.bytesPerFieldElement - 1));
blob.pushByte(0x00);
blob.pushBytes(bytes);
if (bytes.length < 31) {
blob.pushByte(0x80);
active = false;
break;
}
size++;
position += 31;
}
blobs.push(blob);
}
return (as === 'Bytes'
? blobs.map((x) => x.bytes)
: blobs.map((x) => Hex.fromBytes(x.bytes)));
}
function sidecarsToVersionedHashes(sidecars, options = {}) {
const { version } = options;
const as = options.as ?? (typeof sidecars[0].blob === 'string' ? 'Hex' : 'Bytes');
const hashes = [];
for (const { commitment } of sidecars) {
hashes.push(commitmentToVersionedHash(commitment, {
as,
version,
}));
}
return hashes;
}
function to(blobs, to) {
const to_ = to ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes');
const blobs_ = (typeof blobs[0] === 'string'
? blobs.map((x) => Bytes.fromHex(x))
: blobs);
const length = blobs_.reduce((length, blob) => length + blob.length, 0);
const data = Cursor.create(new Uint8Array(length));
let active = true;
for (const blob of blobs_) {
const cursor = Cursor.create(blob);
while (active && cursor.position < blob.length) {
cursor.incrementPosition(1);
let consume = 31;
if (blob.length - cursor.position < 31)
consume = blob.length - cursor.position;
for (const _ in Array.from({ length: consume })) {
const byte = cursor.readByte();
const isTerminator = byte === 0x80 && !cursor.inspectBytes(cursor.remaining).includes(0x80);
if (isTerminator) {
active = false;
break;
}
data.pushByte(byte);
}
}
}
const trimmedData = data.bytes.slice(0, data.position);
return (to_ === 'Hex' ? Hex.fromBytes(trimmedData) : trimmedData);
}
function toHex(blobs) {
return to(blobs, 'Hex');
}
function toBytes(blobs) {
return to(blobs, 'Bytes');
}
function toCommitments(blobs, options) {
const { kzg } = options;
const as = options.as ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes');
const blobs_ = (typeof blobs[0] === 'string'
? blobs.map((x) => Bytes.fromHex(x))
: blobs);
const commitments = [];
for (const blob of blobs_)
commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));
return (as === 'Bytes' ? commitments : commitments.map((x) => Hex.fromBytes(x)));
}
function toProofs(blobs, options) {
const { kzg } = options;
const as = options.as ?? (typeof blobs[0] === 'string' ? 'Hex' : 'Bytes');
const blobs_ = (typeof blobs[0] === 'string'
? blobs.map((x) => Bytes.fromHex(x))
: blobs);
const commitments = (typeof options.commitments[0] === 'string'
? options.commitments.map((x) => Bytes.fromHex(x))
: options.commitments);
const proofs = [];
for (let i = 0; i < blobs_.length; i++) {
const blob = blobs_[i];
const commitment = commitments[i];
proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));
}
return (as === 'Bytes' ? proofs : proofs.map((x) => Hex.fromBytes(x)));
}
function toSidecars(blobs, options) {
const { kzg } = options;
const commitments = options.commitments ?? toCommitments(blobs, { kzg: kzg });
const proofs = options.proofs ??
toProofs(blobs, { commitments: commitments, kzg: kzg });
const sidecars = [];
for (let i = 0; i < blobs.length; i++)
sidecars.push({
blob: blobs[i],
commitment: commitments[i],
proof: proofs[i],
});
return sidecars;
}
function toVersionedHashes(blobs, options) {
const commitments = toCommitments(blobs, options);
return commitmentsToVersionedHashes(commitments, options);
}
class BlobSizeTooLargeError extends Errors.BaseError {
constructor({ maxSize, size }) {
super('Blob size is too large.', {
metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Blobs.BlobSizeTooLargeError'
});
}
}
exports.BlobSizeTooLargeError = BlobSizeTooLargeError;
class EmptyBlobError extends Errors.BaseError {
constructor() {
super('Blob data must not be empty.');
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Blobs.EmptyBlobError'
});
}
}
exports.EmptyBlobError = EmptyBlobError;
class EmptyBlobVersionedHashesError extends Errors.BaseError {
constructor() {
super('Blob versioned hashes must not be empty.');
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Blobs.EmptyBlobVersionedHashesError'
});
}
}
exports.EmptyBlobVersionedHashesError = EmptyBlobVersionedHashesError;
class InvalidVersionedHashSizeError extends Errors.BaseError {
constructor({ hash, size, }) {
super(`Versioned hash "${hash}" size is invalid.`, {
metaMessages: ['Expected: 32', `Received: ${size}`],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Blobs.InvalidVersionedHashSizeError'
});
}
}
exports.InvalidVersionedHashSizeError = InvalidVersionedHashSizeError;
class InvalidVersionedHashVersionError extends Errors.BaseError {
constructor({ hash, version, }) {
super(`Versioned hash "${hash}" version is invalid.`, {
metaMessages: [
`Expected: ${Kzg.versionedHashVersion}`,
`Received: ${version}`,
],
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'Blobs.InvalidVersionedHashVersionError'
});
}
}
exports.InvalidVersionedHashVersionError = InvalidVersionedHashVersionError;
//# sourceMappingURL=Blobs.js.map

1
node_modules/ox/_cjs/core/Blobs.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

85
node_modules/ox/_cjs/core/Block.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toRpc = toRpc;
exports.fromRpc = fromRpc;
const Hex = require("./Hex.js");
const Transaction = require("./Transaction.js");
const Withdrawal = require("./Withdrawal.js");
function toRpc(block, _options = {}) {
const transactions = block.transactions.map((transaction) => {
if (typeof transaction === 'string')
return transaction;
return Transaction.toRpc(transaction);
});
return {
baseFeePerGas: typeof block.baseFeePerGas === 'bigint'
? Hex.fromNumber(block.baseFeePerGas)
: undefined,
blobGasUsed: typeof block.blobGasUsed === 'bigint'
? Hex.fromNumber(block.blobGasUsed)
: undefined,
excessBlobGas: typeof block.excessBlobGas === 'bigint'
? Hex.fromNumber(block.excessBlobGas)
: undefined,
extraData: block.extraData,
difficulty: typeof block.difficulty === 'bigint'
? Hex.fromNumber(block.difficulty)
: undefined,
gasLimit: Hex.fromNumber(block.gasLimit),
gasUsed: Hex.fromNumber(block.gasUsed),
hash: block.hash,
logsBloom: block.logsBloom,
miner: block.miner,
mixHash: block.mixHash,
nonce: block.nonce,
number: (typeof block.number === 'bigint'
? Hex.fromNumber(block.number)
: null),
parentBeaconBlockRoot: block.parentBeaconBlockRoot,
parentHash: block.parentHash,
receiptsRoot: block.receiptsRoot,
sealFields: block.sealFields,
sha3Uncles: block.sha3Uncles,
size: Hex.fromNumber(block.size),
stateRoot: block.stateRoot,
timestamp: Hex.fromNumber(block.timestamp),
totalDifficulty: typeof block.totalDifficulty === 'bigint'
? Hex.fromNumber(block.totalDifficulty)
: undefined,
transactions,
transactionsRoot: block.transactionsRoot,
uncles: block.uncles,
withdrawals: block.withdrawals?.map(Withdrawal.toRpc),
withdrawalsRoot: block.withdrawalsRoot,
};
}
function fromRpc(block, _options = {}) {
if (!block)
return null;
const transactions = block.transactions.map((transaction) => {
if (typeof transaction === 'string')
return transaction;
return Transaction.fromRpc(transaction);
});
return {
...block,
baseFeePerGas: block.baseFeePerGas
? BigInt(block.baseFeePerGas)
: undefined,
blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,
difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,
excessBlobGas: block.excessBlobGas
? BigInt(block.excessBlobGas)
: undefined,
gasLimit: BigInt(block.gasLimit ?? 0n),
gasUsed: BigInt(block.gasUsed ?? 0n),
number: block.number ? BigInt(block.number) : null,
size: BigInt(block.size ?? 0n),
stateRoot: block.stateRoot,
timestamp: BigInt(block.timestamp ?? 0n),
totalDifficulty: BigInt(block.totalDifficulty ?? 0n),
transactions,
withdrawals: block.withdrawals?.map(Withdrawal.fromRpc),
};
}
//# sourceMappingURL=Block.js.map

Some files were not shown because too many files have changed in this diff Show More